<?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('voucher_types', function (Blueprint $table) {
            $table->id();
            $table->string('code', 20)->unique();
            $table->string('name', 60);
            // Drives behaviour: balance-based types (gift/refund/compensation)
            // carry a spendable wallet; rate-based types (discount/promotional)
            // are a one-shot percentage/fixed discount. Data-driven, not
            // branched on the code string.
            $table->boolean('is_balance_based')->default(false);
            $table->unsignedInteger('sort_order')->default(0);
            $table->timestamps();
        });
    }

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