<?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('patient_contacts', function (Blueprint $table) {
            $table->id('contact_id');
            $table->unsignedBigInteger('patient_id'); 
            $table->string('type', 20); 
            $table->string('name', 100); 
            $table->string('patient_phone_number', 12)->nullable();
            $table->string('patient_er_phone_number', 12)->nullable(); 
            $table->string('patient_email', 100)->nullable(); 
            $table->string('patient_er_email', 100)->nullable(); 
            $table->string('pt_house_num', 50)->nullable(); 
            $table->string('pt_street_addr1', 255)->nullable(); 
            $table->string('pt_street_addr2', 255)->nullable(); 
            $table->string('pt_street_addr3', 255)->nullable(); 
            $table->string('pt_landmark', 100)->nullable(); 
            $table->string('pt_city', 100)->nullable(); 
            $table->string('pt_zip_pin_code', 10)->nullable(); 
            $table->string('er_house_num', 50)->nullable(); 
            $table->string('er_street_addr1', 255)->nullable(); 
            $table->string('er_street_addr2', 255)->nullable(); 
            $table->string('er_street_addr3', 255)->nullable(); 
            $table->string('er_landmark', 100)->nullable(); 
            $table->string('er_city', 100)->nullable(); 
            $table->string('er_zip_pin_code', 10)->nullable(); 

       
            $table->foreign('patient_id')->references('patient_id')->on('patient')->onUpdate('no action')->onDelete('no action');
        });
    }

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