<?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::create('vouchers', function (Blueprint $table) {
            $table->id();
            $table->string('batch_code');
            $table->string('voucher_code')->unique();
            $table->string('package_name');
            $table->decimal('price', 10, 2);
            $table->string('status')->default('Unused'); // Unused, Assigned, Redeemed, Expired
            $table->string('assigned_agent')->nullable();
            $table->string('redeemed_by')->nullable();
            $table->timestamp('redeemed_at')->nullable();
            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('vouchers');
    }
};
