<?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('InformasiKegiatan', function (Blueprint $table) {
            $table->id('KegiatanID');
            $table->string('NoRegistrasi', 50)->unique();
            $table->string('JenisDokumen', 50);
            $table->string('NamaKegiatan');
            $table->string('BidangUsaha', 100);
            $table->string('SkalaBesaran', 50);
            $table->string('LokasiKegiatan', 100)->nullable();
            $table->string('Kewenangan', 50);
            $table->string('Pemrakarsa', 100);
            $table->string('ProvinsiKota', 100);
            $table->text('DeskripsiKegiatan');
            $table->text('DampakPotensial');
            $table->string('DeskripsiLokasi');
            $table->decimal('Latitude', 10, 8)->nullable();
            $table->decimal('Longitude', 11, 8)->nullable();
            $table->date('TanggalMulaiPeriode');
            $table->date('TanggalSelesaiPeriode');
            $table->enum('Status', ['aktif', 'nonaktif', 'selesai'])->default('aktif');
            $table->timestamps();

            $table->index(['JenisDokumen', 'Status']);
            $table->index(['TanggalMulaiPeriode', 'TanggalSelesaiPeriode']);
        });
    }

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