<?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('owner_docs', function (Blueprint $table) {
            $table->bigIncrements('Owner_Doc_Id');

            $table->unsignedBigInteger('Owner_ID');
            $table->unsignedBigInteger('DocTy_ID');

            $table->string('Doc_No', 100);

            // Multiple File Upload
            $table->json('Document')->nullable();

            $table->boolean('Is_Verified')->default(0);
            $table->string('Remark', 255)->nullable();

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

            $table->foreign('Owner_ID')
                ->references('Owner_ID')
                ->on('owner_master')
                ->onDelete('cascade');

            $table->foreign('DocTy_ID')
                ->references('DocTy_ID')
                ->on('doc_type_master')
                ->onDelete('cascade');
        });
    }

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