<?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
    {
        // PRC-443 — `client_domains.epp_code` boolean (tinyint) bir feature
        // flag (EPP-code özelliği TLD'den inherit). Transfer auth/EPP code
        // ise registrar'dan gelen alfanumerik string (örn. Auth-Code-Xy9$kL2m).
        // Checkout transfer flow string'i boolean kolona insert etmeye
        // çalışıyordu → SQLSTATE[22007] → checkout fail. Ayrı string kolon
        // ekliyoruz; epp_code boolean feature flag olarak korunuyor.
        Schema::table('client_domains', function (Blueprint $table) {
            $table->string('transfer_epp_code', 255)->nullable()->after('epp_code');
        });
    }

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