<?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->uuid('id')->primary();

            $table->string('name');
            $table->string('legal_name');
            $table->string('cnpj')->unique()->nullable();

            $table->string('profile_image_path')->nullable();

            // Informações Técnicas
            $table->string('pbx_hosting')->nullable();
            $table->date('activation_date')->nullable();
            $table->string('carrier')->nullable();
            $table->string('access_type')->nullable();
            $table->ipAddress('server_ip')->nullable();
            $table->text('root_password')->nullable();
            $table->text('ddr_out')->nullable();
            $table->text('ddr_key')->nullable();
            $table->longText('observation')->nullable();

            $table->boolean('has_call_center')->default(false);
            $table->boolean('has_voice_gateway')->default(false);
            $table->boolean('has_fop2')->default(false);

            $table->json('modules')->nullable();
            $table->string('whatsapp_number')->nullable();
            $table->date('whatsapp_activation_date')->nullable();

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

    public function down(): void
    {
        Schema::dropIfExists('clients');
    }
};
