<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('company_kyc_submissions', function (Blueprint $table) {
            // Make identity_card_number nullable since it's only used for non-NIN cards
            // For NIN (National Identity Number), we use the encrypted fields instead
            $table->string('identity_card_number')->nullable()->change();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('company_kyc_submissions', function (Blueprint $table) {
            // Revert to NOT NULL (this may fail if there are NULL values in the database)
            $table->string('identity_card_number')->nullable(false)->change();
        });
    }
};
