<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('contract_configs', function (Blueprint $table) {
            $table->id();
            $table->foreignIdFor(\App\Models\ContractType::class, 'contract_type_id')->constrained('contract_types')->cascadeOnDelete();
            $table->foreignIdFor(\App\Models\Segment::class, 'initial_segment_id')->constrained('segments')->cascadeOnDelete();
            $table->boolean('active')->default(true);
            $table->timestamps();
            $table->unique('contract_type_id');
        });
    }

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