<?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('preferens_permohonan', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained()->onDelete('cascade'); // Menghubungkan dengan tabel users
            $table->json('bidang_sub_sektor_ekonomi_kreatif'); // Menyimpan pilihan bidang
            $table->json('kategori'); // Menyimpan pilihan kategori
            $table->date('batas_terima_tawaran')->nullable(); // Batas terima tawaran
            $table->decimal('range_min', 20, 2)->nullable(); // Nilai minimum
            $table->decimal('range_max', 20, 2)->nullable(); // Nilai maksimum
            $table->json('status')->nullable(); // Menyimpan status
            $table->timestamps();
        });
    }

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