<?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('forms', function (Blueprint $table) {
            $table->boolean('auto_reply_enabled')->default(false)->after('bcc');
            $table->string('auto_reply_subject', 500)->nullable()->after('auto_reply_enabled');
            $table->text('auto_reply_message')->nullable()->after('auto_reply_subject');
            $table->unsignedInteger('rate_limit')->nullable()->after('auto_reply_message');
        });
    }

    public function down(): void
    {
        Schema::table('forms', function (Blueprint $table) {
            $table->dropColumn(['auto_reply_enabled', 'auto_reply_subject', 'auto_reply_message', 'rate_limit']);
        });
    }
};
