<?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('file_custom_fields', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('project_category_id')->nullable(); // INT, nullable
            
            $table->string('field_name');
            $table->string('field_display_name');
            $table->enum('field_type', ['text', 'number', 'dropdown', 'date', 'checkbox']);
            $table->text('field_values')->nullable(); // For dropdown values
            $table->boolean('is_required')->default(false);
            $table->boolean('is_exportable')->default(false);
            $table->timestamps();

            $table->foreign('project_category_id')->references('id')->on('project_category')->onDelete('set null');

        });

        
    }

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