<?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('road_patrols', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->double('start_lat', null, 0);
            $table->double('start_lon', null, 0);
            $table->double('end_lat', null, 0);
            $table->double('end_lon', null, 0);
            $table->string('officer_phone_number', 20)->nullable();
            $table->unsignedInteger('operator_id')->nullable()->index('road_patrols_operator_id_foreign');
            $table->string('operator_name')->nullable();
            $table->string('officer_plaque', 16)->nullable();
            $table->bigInteger('start_way_id')->nullable();
            $table->bigInteger('end_way_id')->nullable();
            $table->unsignedInteger('supervisor_id')->nullable()->index('road_patrols_supervisor_id_foreign');
            $table->string('supervisor_name')->nullable();
            $table->text('supervisor_description')->nullable();
            $table->timestamp('supervising_time')->nullable();
            $table->unsignedSmallInteger('status')->nullable();
            $table->string('status_fa', 100)->nullable();
            $table->double('distance', null, 0)->nullable();
            $table->timestamps();
            $table->unsignedTinyInteger('province_id')->nullable()->index('road_patrols_province_id_foreign');
            $table->string('province_fa')->nullable();
            $table->unsignedSmallInteger('city_id')->nullable()->index('road_patrols_city_id_foreign');
            $table->string('city_fa')->nullable();
            $table->unsignedBigInteger('edare_id')->nullable();
            $table->string('edare_name')->nullable();
            $table->timestamp('start_time')->default('0000-00-00 00:00:00');
            $table->timestamp('end_time')->default('0000-00-00 00:00:00');
            $table->string('officer_name')->nullable();
            $table->text('description')->nullable();
        });
    }

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