<?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('terminal_illnesses', function (Blueprint $table) {
            $table->id();
            $table->foreignId('solicitor_id')->nullable()
                ->constrained()
                ->cascadeOnDelete();

            $table->foreignId('claim_id')
                ->constrained('claims')
                ->cascadeOnDelete();

            $table->text('terminal_illness_details')->nullable();

            $table->boolean('applied_advance_payment')->nullable();
            $table->boolean('permission_confirm_health')->nullable();
            $table->boolean('provide_ds1500')->nullable();

            $table->boolean('agree_contact_healthcare')->nullable();

            $table->boolean('has_medical_ref')->nullable();
            $table->string('medical_reference_number', 100)->nullable();

            $table->string('healthcare_type')->nullable();
            $table->string('healthcare_name')->nullable();
            $table->string('healthcare_place_of_work')->nullable();
            $table->string('healthcare_email')->nullable();
            $table->string('healthcare_phone')->nullable();

            $table->string('healthcare_address_1')->nullable();
            $table->string('healthcare_address_2')->nullable();
            $table->string('healthcare_address_3')->nullable();
            $table->string('healthcare_postcode')->nullable();

            $table->timestamps();
        });

    }

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