<?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('observed_items', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('road_patrol_id')->nullable()->index('observed_items_road_patrol_id_foreign');
            $table->unsignedTinyInteger('item_id')->nullable();
            $table->string('item_name')->nullable();
            $table->unsignedTinyInteger('sub_item_id')->nullable();
            $table->string('sub_item_name')->nullable();
            $table->string('local_name')->nullable();
            $table->text('description')->nullable();
            $table->unsignedSmallInteger('status')->nullable();
            $table->string('status_fa', 100)->nullable();
            $table->unsignedBigInteger('road_item_id')->nullable()->index('observed_items_road_item_id_foreign');
            $table->double('start_lat', null, 0);
            $table->double('start_lon', null, 0);
            $table->double('end_lat', null, 0)->nullable();
            $table->double('end_lon', null, 0)->nullable();
            $table->timestamps();
            $table->unsignedSmallInteger('priority')->nullable();
            $table->string('priority_fa', 100)->nullable();
        });
    }

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