<?php

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

return new class () extends Migration {
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('analisa_fakta', function (Blueprint $table) {
            $table->id();
            // Foreign key to analisa table
            $table->unsignedBigInteger('analisa_id');
            $table->foreign('analisa_id')->references('id')->on('analisa');

            $table->text('fakta_positif');
            $table->text('fakta_negatif');
            $table->text('rute_menju');
            $table->string('batas_batas');
            $table->text('kondisi_linkungan');
            $table->text('kondisi_lain_bangunan');
            $table->text('informasi_dokument');
            $table->string('peruntukan');
            $table->string('kdb');
            $table->string('kdh');
            $table->string('gsb');
            $table->string('max_lantai');
            $table->string('klb');
            $table->string('gss');
            $table->string('pelebaran_jalan');
            $table->string('nama_petugas');
            $table->string('foto_tempat');
            $table->string('lat');
            $table->string('lng');
            $table->text('keterangan');

            $table->char('authorized_status', 1)->nullable();
            $table->timestamps();
            $table->timestamp('authorized_at')->nullable();
            $table->unsignedBigInteger('authorized_by')->nullable();
            $table->softDeletes();
            $table->unsignedBigInteger('created_by')->nullable();
            $table->unsignedBigInteger('updated_by')->nullable();
            $table->unsignedBigInteger('deleted_by')->nullable();
        });
    }

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