<?php

declare(strict_types=1);

use Hyperf\Database\Schema\Blueprint;
use Hypervel\Database\Migrations\Migration;
use Hypervel\Support\Facades\Schema;

return new class extends Migration {
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('organizations', function (Blueprint $table) {
            $table->string('registration_number')->nullable()->after('address');
            $table->string('cin')->nullable()->after('registration_number');
            $table->string('tin')->nullable()->after('cin');
            $table->string('cooperative_type')->nullable()->after('tin'); // e.g., Multi-purpose, Credit
            $table->string('cooperative_category')->nullable()->after('cooperative_type'); // Micro, Small, Medium, Large
            $table->date('registration_date')->nullable()->after('cooperative_category');
            $table->string('contact_person')->nullable()->after('registration_date');
            $table->string('contact_number')->nullable()->after('contact_person');
            $table->string('contact_email')->nullable()->after('contact_number');
            $table->string('compliance_status')->default('UNKNOWN')->after('contact_email');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('organizations', function (Blueprint $table) {
            $table->dropColumn([
                'registration_number',
                'cin',
                'tin',
                'cooperative_type',
                'cooperative_category',
                'registration_date',
                'contact_person',
                'contact_number',
                'contact_email',
                'compliance_status',
            ]);
        });
    }
};
