<?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('contract_subitems', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('project_title')->nullable();
            $table->tinyInteger('project_type_id')->nullable();
            $table->string('project_type_fa')->nullable();
            $table->string('project_type_fa_for_chart')->nullable();
            $table->integer('city_id')->nullable();
            $table->string('city_fa')->nullable();
            $table->tinyInteger('province_id')->nullable();
            $table->string('province_fa')->nullable();
            $table->integer('axis_type_id')->nullable();
            $table->string('axis_type_fa')->nullable();
            $table->tinyInteger('followup_priority_project_id')->nullable();
            $table->string('followup_priority_project')->nullable();
            $table->tinyInteger('priority_project')->nullable();
            $table->string('priority_project_fa', 119)->nullable();
            $table->string('operator_name')->nullable();
            $table->tinyInteger('last_status_id')->nullable();
            $table->integer('progress_project')->nullable();
            $table->string('last_status_fa')->nullable();
            $table->string('last_status_fa_for_chart', 119)->nullable();
            $table->string('last_digit_project')->nullable();
            $table->string('last_function_operator')->nullable();
            $table->string('last_payable_operator')->nullable();
            $table->string('complete_payable')->nullable();
            $table->dateTime('last_date_update')->nullable();
            $table->string('created_at_fa')->nullable();
            $table->string('updated_at_fa')->nullable();
            $table->string('unique_code');
            $table->string('operation_type_id1', 11)->nullable();
            $table->string('operation_type_fa1', 255)->nullable();
            $table->string('operation_type_unit1', 255)->nullable();
            $table->float('operation_type_amount1', null, 0)->nullable();
            $table->float('operation_type_progress1', null, 0)->nullable();
            $table->float('operation_type_tonaj1', null, 0)->nullable();
            $table->string('operation_type_id2', 11)->nullable();
            $table->string('operation_type_fa2', 255)->nullable();
            $table->string('operation_type_unit2', 255)->nullable();
            $table->float('operation_type_amount2', null, 0)->nullable();
            $table->float('operation_type_progress2', null, 0)->nullable();
            $table->float('operation_type_tonaj2', null, 0)->nullable();
            $table->string('operation_type_id3', 11)->nullable();
            $table->string('operation_type_fa3', 255)->nullable();
            $table->string('operation_type_unit3', 255)->nullable();
            $table->float('operation_type_amount3', null, 0)->nullable();
            $table->float('operation_type_progress3', null, 0)->nullable();
            $table->float('operation_type_tonaj3', null, 0)->nullable();
            $table->string('operation_type_id4', 11)->nullable();
            $table->string('operation_type_fa4', 255)->nullable();
            $table->string('operation_type_unit4', 255)->nullable();
            $table->float('operation_type_amount4', null, 0)->nullable();
            $table->float('operation_type_progress4', null, 0)->nullable();
            $table->float('operation_type_tonaj4', null, 0)->nullable();
            $table->string('image_path1', 255)->nullable();
            $table->string('image_path2', 255)->nullable();
            $table->string('axis_name_fa', 255)->nullable();
            $table->string('start_lat', 255)->nullable();
            $table->string('end_lat', 255)->nullable();
            $table->string('start_lng', 255)->nullable();
            $table->string('end_lng', 255)->nullable();
            $table->string('operator_phone')->nullable();
            $table->dateTime('contract_date_from_parent_contract')->nullable();
            $table->unsignedBigInteger('contract_id')->index('contract_foreign_key');
            $table->bigInteger('start_way_id')->nullable();
            $table->bigInteger('end_way_id')->nullable();
            $table->unsignedBigInteger('user_id')->nullable();
            $table->string('contract_moshaver_tarahi')->nullable()->default('not_set');
            $table->string('contract_moshaver_nezarat')->nullable()->default('not_set');
            $table->timestamps();
            $table->unsignedBigInteger('required_bitumen')->nullable();
            $table->unsignedBigInteger('used_bitumen')->nullable();
            $table->string('bridge_number', 50)->nullable();
        });
    }

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