<?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
    {
        // sales_records: tax_type 컬럼 추가
        Schema::table('sales_records', function (Blueprint $table) {
            $table->string('tax_type', 20)->default('taxable')->after('record_type');
        });

        // payables: tax_invoice_issued 컬럼 추가
        Schema::table('payables', function (Blueprint $table) {
            $table->boolean('tax_invoice_issued')->default(false)->after('memo');
        });

        // card_transactions: deduction_type 컬럼 추가 (공제/불공제 구분)
        Schema::table('card_transactions', function (Blueprint $table) {
            $table->string('deduction_type', 20)->default('deductible')->after('status');
        });
    }

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

        Schema::table('payables', function (Blueprint $table) {
            $table->dropColumn('tax_invoice_issued');
        });

        Schema::table('card_transactions', function (Blueprint $table) {
            $table->dropColumn('deduction_type');
        });
    }
};
