<?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('checklist_configs', function (Blueprint $table) {
            $table->id();
            $table->string('field_name', 150);
            $table->string('field_key', 100)->unique();
            $table->enum('field_type', ['text', 'number', 'boolean', 'select']);
            $table->json('options')->nullable();
            $table->tinyInteger('is_required')->default(0);
            $table->tinyInteger('is_active')->default(1);
            $table->integer('sort_order')->default(0);
            $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
            $table->timestamps();
        });
    }

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