<?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('lead_source_endpoints', function (Blueprint $table)
        {
            $table->id();
            $table->foreignId('solicitor_id')->nullable()
                ->constrained()
                ->cascadeOnDelete();
            $table->uuid('slug')->index();
            $table->foreignId('lead_source_id')->constrained('lead_sources')->onDelete('cascade');
            $table->string('display_name');
            $table->string('key');
            $table->enum('status', ['draft', 'test', 'active', 'inactive'])->default('draft')->index();
            $table->timestamps();
            $table->softDeletes();
        });
    }

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