<?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
    {
        Schema::table('hometax_invoices', function (Blueprint $table) {
            // 공급자 상세
            $table->string('invoicer_branch_num', 10)->nullable()->comment('공급자 종사업장번호')->after('invoicer_ceo_name');
            $table->string('invoicer_address', 300)->nullable()->comment('공급자 사업장주소')->after('invoicer_branch_num');
            $table->string('invoicer_biz_type', 100)->nullable()->comment('공급자 업태')->after('invoicer_address');
            $table->string('invoicer_biz_class', 100)->nullable()->comment('공급자 종목')->after('invoicer_biz_type');
            $table->string('invoicer_email', 200)->nullable()->comment('공급자 이메일')->after('invoicer_biz_class');
            $table->string('invoicer_email2', 200)->nullable()->comment('공급자 이메일2')->after('invoicer_email');

            // 공급받는자 상세
            $table->string('invoicee_branch_num', 10)->nullable()->comment('공급받는자 종사업장번호')->after('invoicee_ceo_name');
            $table->string('invoicee_address', 300)->nullable()->comment('공급받는자 사업장주소')->after('invoicee_branch_num');
            $table->string('invoicee_biz_type', 100)->nullable()->comment('공급받는자 업태')->after('invoicee_address');
            $table->string('invoicee_biz_class', 100)->nullable()->comment('공급받는자 종목')->after('invoicee_biz_type');
            $table->string('invoicee_email', 200)->nullable()->comment('공급받는자 이메일')->after('invoicee_biz_class');
            $table->string('invoicee_email2', 200)->nullable()->comment('공급받는자 이메일2')->after('invoicee_email');
        });
    }

    public function down(): void
    {
        Schema::table('hometax_invoices', function (Blueprint $table) {
            $table->dropColumn([
                'invoicer_branch_num', 'invoicer_address', 'invoicer_biz_type', 'invoicer_biz_class', 'invoicer_email', 'invoicer_email2',
                'invoicee_branch_num', 'invoicee_address', 'invoicee_biz_type', 'invoicee_biz_class', 'invoicee_email', 'invoicee_email2',
            ]);
        });
    }
};
