<?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::create('exp_rate_schedules', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('type')->default('exp_rate'); // exp_rate, double_money, double_drop, double_sp, no_trade, no_auction, no_mail
            $table->integer('exp_rate_value')->nullable()->default(1);
            $table->boolean('double_money_value')->nullable()->default(false);
            $table->boolean('double_drop_value')->nullable()->default(false);
            $table->boolean('double_sp_value')->nullable()->default(false);
            $table->boolean('no_trade_value')->nullable()->default(false);
            $table->boolean('no_auction_value')->nullable()->default(false);
            $table->boolean('no_mail_value')->nullable()->default(false);
            $table->dateTime('start_time');
            $table->dateTime('end_time');
            $table->boolean('is_active')->default(true);
            $table->boolean('is_applied')->default(false);
            $table->string('original_value')->nullable(); // JSON string of original values
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('exp_rate_schedules');
    }
};
