<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('clients', function (Blueprint $table) {
            $table->id();

            // Básicos
            $table->string('name', 200);
            $table->string('shortname', 50)->unique();

            // Identificador externo (CRM)
            $table->string('crm_id', 100)->nullable()->unique();

            // Contacto
            $table->json('contacts')->nullable();

            // Información
            $table->text('description')->nullable();
            $table->string('jira')->nullable();

            // Estado del cliente dentro del sistema
            $table->boolean('actived')->default(true);

            // Extensión flexible
            $table->json('metadata')->nullable();

            // Observaciones internas
            $table->text('observation')->nullable();

            $table->timestamps();
            $table->softDeletes();
        });

    }


    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('clients');
    }
};
