<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('form_entertainment_presentation', function (Blueprint $table) {
            // normal approval
            $table->timestamp('approved_at')->nullable()->after('status');
            $table->foreignId('approved_by')->nullable()->constrained('admins')->cascadeOnDelete()->after('status');

            // final approval
            $table->timestamp('final_approved_at')->nullable()->after('status');
            $table->foreignId('final_approved_by')->nullable()->constrained('admins')->cascadeOnDelete()->after('status');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('form_entertainment_presentation', function (Blueprint $table) {
            $table->dropForeign(['approved_by']);
            $table->dropForeign(['final_approved_by']);
            $table->dropColumn('approved_at');
            $table->dropColumn('approved_by');
            $table->dropColumn('final_approved_at');
            $table->dropColumn('final_approved_by');
        });
    }
};
