<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

/**
 * Master Control VAT kill switch (docs/migration-plan.md Decisions Log —
 * "Master Control & Admin Settings"), same shape as the loyalty/voucher
 * switches added in 2026_08_09_090000: one landlord-level toggle, defaulting
 * to OFF (unlike loyalty/vouchers) because VAT is a legal/registration
 * decision a tenant opts INTO, not a promotional feature every tenant already
 * has. When off, no VAT rate field, calculation, or figure may appear
 * anywhere in the tenant's app or on its printed invoices (see VatSettings,
 * InvoiceService, InvoiceDocument, ProductResource, InvoiceResource, Pos).
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::table('tenant_settings', function (Blueprint $table) {
            $table->boolean('invoice_vat_enabled')->default(false);
        });
    }

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