<?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::table('vouchers', function (Blueprint $table) {
            // Manual kill switch, alongside the lifecycle status (active /
            // expired / void / exhausted): a deactivated voucher is rejected
            // at checkout even while its status still says active — same
            // active/inactive control every other promotional module has.
            $table->boolean('is_active')->default(true)->after('is_stackable');
        });
    }

    public function down(): void
    {
        Schema::table('vouchers', function (Blueprint $table) {
            $table->dropColumn('is_active');
        });
    }
};
