<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
    use Modules\Lpj\Models\Permohonan;

    return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('laporan_externals', function (Blueprint $table) {
            $table->id();
            $table->foreignIdFor(Permohonan::class)->constrained('permohonan')->onDelete('cascade');
            $table->string('nomor_laporan');
            $table->date('tgl_final_laporan')->nullable();
            $table->decimal('nilai_pasar', 15, 2)->nullable();
            $table->decimal('indikasi_nilai_likuidasi', 15, 2)->nullable();
            $table->decimal('indikasi_nilai_pasar_tanah', 15, 2)->nullable();
            $table->decimal('estimasi_harga_tanah', 15, 2)->nullable();
            $table->decimal('estimasi_harga_bangunan', 15, 2)->nullable();
            $table->decimal('indikasi_nilai_pasar_bangunan', 15, 2)->nullable();
            $table->decimal('indikasi_nilai_pasar_sarana_pelengkap', 15, 2)->nullable();
            $table->decimal('indikasi_nilai_pasar_mesin', 15, 2)->nullable();
            $table->decimal('indikasi_nilai_pasar_kendaraan_alat_berat', 15, 2)->nullable();
            $table->string('file_resume')->nullable(); // New field for resume file
            $table->string('file_laporan')->nullable(); // New field for report file
            $table->timestamps();
            $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('laporan_externals');
    }
};
