<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('lapors', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained()->onDelete('cascade');
            $table->string('nama_petani');
            $table->string('lokasi');
            $table->string('koordinat');
            $table->string('lat');
            $table->string('lng');
            $table->string('jenis_hama');
            $table->string('tingkat_serangan');
            $table->string('luas_lahan');
            $table->string('lama_kejadian');
            $table->text('deskripsi');
            $table->string('foto')->nullable();

            // AHP
            $table->double('skor_ahp')->nullable();

            // TOPSIS
            $table->double('nilai_preferensi')->nullable();
            $table->integer('ranking')->nullable();

            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('lapors');
    }

};
