<?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_sub_items_histories', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('project_title')->nullable();
            $table->string('project_type_id');
            $table->string('project_type_fa');
            $table->string('operation_type_id1')->nullable();
            $table->string('operation_type_fa1')->nullable();
            $table->float('operation_type_amount1', null, 0)->nullable();
            $table->float('operation_type_progress1', null, 0)->nullable();
            $table->string('operation_type_id2')->nullable();
            $table->string('operation_type_fa2')->nullable();
            $table->float('operation_type_amount2', null, 0)->nullable();
            $table->float('operation_type_progress2', null, 0)->nullable();
            $table->string('operation_type_id3')->nullable();
            $table->string('operation_type_fa3')->nullable();
            $table->float('operation_type_amount3', null, 0)->nullable();
            $table->float('operation_type_progress3', null, 0)->nullable();
            $table->string('operation_type_id4')->nullable();
            $table->string('operation_type_fa4')->nullable();
            $table->float('operation_type_amount4', null, 0)->nullable();
            $table->float('operation_type_progress4', null, 0)->nullable();
            $table->integer('city_id')->nullable();
            $table->string('city_fa')->nullable();
            $table->integer('province_id')->nullable();
            $table->string('province_fa')->nullable();
            $table->string('axis_type_id')->nullable();
            $table->string('axis_type_fa')->nullable();
            $table->string('axis_name_id')->nullable();
            $table->string('axis_name_fa')->nullable();
            $table->string('start_lat')->nullable();
            $table->string('end_lat')->nullable();
            $table->string('start_lng')->nullable();
            $table->string('end_lng')->nullable();
            $table->string('followup_priority_project')->nullable();
            $table->string('priority_project')->nullable();
            $table->string('operator_name')->nullable();
            $table->string('operator_phone')->nullable();
            $table->dateTime('last_date_update')->nullable();
            $table->string('updated_at_fa')->nullable();
            $table->string('created_at_fa')->nullable();
            $table->string('last_status_id')->nullable();
            $table->string('last_status_fa')->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->string('image_path1')->nullable();
            $table->string('image_path2')->nullable();
            $table->string('unique_code')->nullable();
            $table->unsignedBigInteger('subitem_id')->nullable()->index('contract_sub_items_histories_subitem_id_foreign');
            $table->bigInteger('progress_project')->nullable()->default(0);
            $table->string('operation_type_unit1')->nullable();
            $table->string('operation_type_unit2')->nullable();
            $table->string('operation_type_unit3')->nullable();
            $table->string('operation_type_unit4')->nullable();
            $table->float('operation_type_tonaj1', null, 0)->nullable();
            $table->float('operation_type_tonaj2', null, 0)->nullable();
            $table->float('operation_type_tonaj3', null, 0)->nullable();
            $table->float('operation_type_tonaj4', null, 0)->nullable();
            $table->integer('is_corrected')->nullable();
            $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_sub_items_histories');
    }
};
