<?php

use App\Enums\IsShow;
use App\Enums\RewardCategory;
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('rewards', function (Blueprint $table) {
            $table->id();
            $table->string('name', 30);
            $table->unsignedInteger('points');
            $table->unsignedInteger('stock')->nullable();
            $table->enum('category', RewardCategory::values())->default(RewardCategory::REGULAR)->comment(RewardCategory::comment());
            $table->enum('is_show', IsShow::values())->default(IsShow::SHOW)->comment(IsShow::comment());
            $table->date('start_date');
            $table->date('end_date')->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

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