<?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_verification_requests', function (Blueprint $table): void {
            $table->id();

            $table->string('action', 50);
            $table->string('status', 50)->default('pending');
            $table->nullableMorphs('subject');
            $table->foreignId('submitted_by_id')->constrained('users')->restrictOnDelete();
            $table->foreignId('verified_by_id')->nullable()->constrained('users')->restrictOnDelete();
            $table->json('payload');
            $table->timestamp('verified_at')->nullable();

            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
        });
    }

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