<?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('folders', function (Blueprint $table) {
            $table->timestamp('confirmation_requested_at')->nullable()->after('closed_at');
            $table->unsignedBigInteger('confirmation_media_id')->nullable()->after('confirmation_requested_at');
            $table->string('confirmed_by_type')->nullable()->after('confirmation_media_id');
            $table->unsignedBigInteger('confirmed_by_id')->nullable()->after('confirmed_by_type');
            $table->text('confirmation_signature')->nullable()->after('confirmed_by_id');
            $table->timestamp('refused_at')->nullable()->after('confirmation_signature');
            $table->text('refusal_reason')->nullable()->after('refused_at');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('folders', function (Blueprint $table) {
            $table->dropColumn([
                'confirmation_requested_at',
                'confirmation_media_id',
                'confirmed_by_type',
                'confirmed_by_id',
                'confirmation_signature',
                'refused_at',
                'refusal_reason',
            ]);
        });
    }
};
