<?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('c3_call_logs', function (Blueprint $table) {
            $table->id();
            $table->date('date')->nullable();
            $table->string('call_in_time')->nullable();
            $table->string('caller_id', 50)->nullable()->comment('Survivor Code e.g. WEEP94I2');
            $table->enum('gender', ['F', 'M'])->nullable();
            $table->integer('age')->nullable();
            $table->boolean('person_with_disability')->default(false);
            $table->string('residential_status', 50)->nullable();
            $table->string('state', 100)->nullable();
            $table->string('county', 100)->nullable();
            $table->string('payam', 100)->nullable();
            $table->string('boma', 100)->nullable();

            // Incidence Types (checkbox-style from Excel)
            $table->boolean('denial_of_resources')->default(false);
            $table->boolean('rape_case')->default(false);
            $table->boolean('psychological_emotional_abuse')->default(false);
            $table->boolean('child_marriage')->default(false);
            $table->boolean('wife_beating')->default(false);
            $table->string('other_incidence_type')->nullable();

            $table->text('requested_need_of_gbv_survivor')->nullable();
            $table->string('referred_to')->nullable();
            $table->boolean('follow_up_required')->default(false);
            $table->date('follow_up_date')->nullable();
            $table->string('satisfaction_feedback')->nullable()->comment('Yes/No');
            $table->string('call_attendant_name', 100)->nullable();

            $table->timestamps();

            $table->index('date');
            $table->index('gender');
            $table->index('state');
            $table->index('caller_id');
        });
    }

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