<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('lawmakers_correspondences', function (Blueprint $table) {
            $table->bigInteger('id', true);
            $table->string('unique_code')->nullable();
            $table->integer('province_id')->nullable();
            $table->string('province_fa')->nullable();
            $table->integer('constituency_id')->nullable();
            $table->string('constituency_fa')->nullable();
            $table->string('lawmaker_name')->nullable();
            $table->text('project_name')->nullable();
            $table->integer('unit_id')->nullable();
            $table->string('unit_fa')->nullable();
            $table->double('amount', null, 0)->nullable();
            $table->double('total_credit', null, 0)->nullable();
            $table->double('national_credit', null, 0)->nullable();
            $table->double('province_credit', null, 0)->nullable();
            $table->double('licence_credit', null, 0)->nullable();
            $table->text('preaction_by_setad')->nullable();
            $table->text('action_by_province')->nullable();
            $table->text('needed_actions')->nullable();
            $table->text('last_action')->nullable();
            $table->integer('last_status_id')->nullable()->default(0);
            $table->string('last_update_fa')->nullable();
            $table->timestamp('created_at')->useCurrentOnUpdate()->useCurrent();
            $table->timestamp('updated_at')->default('0000-00-00 00:00:00');
        });
    }

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