<?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('sellers', function (Blueprint $table) {
            // Address Details
            $table->text('address')->nullable()->after('country');
            $table->string('city')->nullable()->after('address');
            $table->string('pincode')->nullable()->after('city');

            // Business Details
            $table->string('business_type')->nullable()->after('company_name'); // e.g., Manufacturer, Exporter
            $table->year('establishment_year')->nullable()->after('business_type');

            // Bank Details
            $table->string('bank_name')->nullable()->after('subscription_id');
            $table->string('account_name')->nullable()->after('bank_name');
            $table->string('account_number')->nullable()->after('account_name');
            $table->string('ifsc_code')->nullable()->after('account_number');
            $table->string('branch_name')->nullable()->after('ifsc_code');

            // KYC Documents
            $table->string('pan_no')->nullable()->after('gst');
            $table->string('pan_doc')->nullable()->after('gst_doc');
            $table->string('cancelled_cheque_doc')->nullable()->after('pan_doc');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('sellers', function (Blueprint $table) {
            $table->dropColumn([
                'address', 'city', 'pincode',
                'business_type', 'establishment_year',
                'bank_name', 'account_name', 'account_number', 'ifsc_code', 'branch_name',
                'pan_no', 'pan_doc', 'cancelled_cheque_doc'
            ]);
        });
    }
};
