<?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('items', function (Blueprint $table) {
            $table->decimal('opening_quantity', 15, 3)->default(0)->after('stock_qty');
            $table->string('sale_currency', 10)->default('INR')->after('sale_rate');
            $table->decimal('sale_cess_percent', 8, 2)->default(0)->after('sale_currency');
            $table->decimal('sale_cess_amount', 15, 2)->default(0)->after('sale_cess_percent');
            $table->string('purchase_currency', 10)->default('INR')->after('purchase_rate');
            $table->decimal('purchase_cess_percent', 8, 2)->default(0)->after('purchase_currency');
            $table->decimal('purchase_cess_amount', 15, 2)->default(0)->after('purchase_cess_percent');
        });
    }

    public function down(): void
    {
        Schema::table('items', function (Blueprint $table) {
            $table->dropColumn([
                'opening_quantity',
                'sale_currency', 'sale_cess_percent', 'sale_cess_amount',
                'purchase_currency', 'purchase_cess_percent', 'purchase_cess_amount',
            ]);
        });
    }
};
