<?php

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

return new class extends Migration
{
     public function up()
    {
        Schema::create('animal_complaints', function (Blueprint $table) {
            $table->bigIncrements('ANC_Id');

            $table->dateTime('Complaint_Date')->nullable();

            // Foreign Keys
            $table->unsignedBigInteger('CTM_Id');
            $table->unsignedBigInteger('PR_Id');

            $table->string('Complaint_Type', 100)->nullable();
            $table->text('Description')->nullable();
            $table->integer('Area_Id')->nullable();

            $table->enum('Status', [
                'Draft',
                'Pending',
                'In Progress',
                'Rejected',
                'Completed'
            ])->default('Draft');

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

            // FK Constraints
            $table->foreign('CTM_Id')->references('CTM_Id')->on('ctzn_master')->onDelete('cascade');
            $table->foreign('PR_Id')->references('PR_Id')->on('pet_registration')->onDelete('cascade');
        });
    }

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