<?php

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

/**
 * When a customer's VAT ID was confirmed as valid.
 *
 * Reverse charge zeroes the VAT we collect, so it may not hinge on a string the
 * customer typed. Until a VAT ID is verified this stays null and the domestic
 * rate applies — over-collecting, which is correctable, rather than
 * under-collecting, which is a tax liability.
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::table('customers', function (Blueprint $table) {
            $table->timestamp('vat_id_verified_at')->nullable()->after('vat_id');
        });
    }

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