<?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('events', function (Blueprint $table) {
            $table->id();
            $table->string('name');                     // Event name, e.g. "Registration Milestone 100"
            $table->string('type')->default('registration'); // Event type: registration, login, etc.
            $table->integer('milestone');               // Target milestone, e.g. 100, 500, 1000
            $table->integer('item_id');                 // Reward item ID
            $table->string('item_name');                // Item name for display
            $table->integer('item_count')->default(1);  // Item quantity
            $table->integer('protect_type')->default(0);
            $table->string('octet')->nullable();
            $table->integer('mask')->default(0);
            $table->string('mail_title')->nullable();
            $table->text('mail_message')->nullable();
            $table->boolean('is_active')->default(true);
            $table->timestamp('start_date')->nullable();
            $table->timestamp('end_date')->nullable();
            $table->integer('created_by')->nullable();
            $table->timestamps();
        });
    }

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