<?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::table('pengesahan', function (Blueprint $table) {
            $table->string('status')->default('belum_semak')->after('dihantar_pada');
            $table->foreignId('checker_id')->nullable()->after('status')->constrained('users')->onDelete('set null');
            $table->text('catatan')->nullable()->after('checker_id');
            $table->timestamp('disemak_pada')->nullable()->after('catatan');
        });
    }

    public function down(): void
    {
        Schema::table('pengesahan', function (Blueprint $table) {
            $table->dropForeign(['checker_id']);
            $table->dropColumn(['status', 'checker_id', 'catatan', 'disemak_pada']);
        });
    }
};
