<?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::create('tax_rate', function (Blueprint $table) {

    $table->bigIncrements('TxRt_Id');

    $table->unsignedInteger('TxTy_ID');
    $table->unsignedInteger('FY_Id');

    $table->unsignedBigInteger('UsgTy_Id')->nullable();
    $table->unsignedBigInteger('Zone_Id')->nullable();

    $table->decimal('Slab_From',10,2)->default(0);
    $table->decimal('Slab_To',10,2)->nullable();
    $table->decimal('Rate',7,4);
    $table->enum('Rate_Type',['Percent','PerSqFt','Fixed'])->default('Percent');
    $table->decimal('Min_Amount',10,2)->default(0);

    $table->timestamps();
    $table->softDeletes();

    $table->foreign('TxTy_ID')->references('TxTy_ID')->on('tax_type_masters');
    $table->foreign('FY_Id')->references('FY_Id')->on('fyear_master');
    $table->foreign('UsgTy_Id')->references('UsgTy_Id')->on('property_usage_types');
    $table->foreign('Zone_Id')->references('Zon_Id')->on('zone_master');
});
    }

    public function down(): void
    {
        Schema::dropIfExists('tax_rate');
    }
};
