<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTaxTypesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tax_types', function (Blueprint $table) {
            $table->id();
            $table->string('code')->unique();
            $table->bigInteger('tax_name_id')->unsigned()->nullable();
            $table->string('category')->nullable();
            $table->double('rate')->nullable();

            $table->string('tax_base_type'); // price | formula
            $table->string('tax_base_formula')->nullable(); // ex: 11/12

            $table->boolean('status')->nullable();
            $table->text('description')->nullable();
            $table->string('legal_basis')->nullable();
            $table->date('updated_date')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('tax_types');
    }
}
