<?php

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

/**
 * PRC-1143 — konsolide şema: `client_custom_fields` tablosunun TAM tanımı (tek dosya).
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::create('client_custom_fields', function (Blueprint $t) {
            $t->id();
            $t->string('name', 255);
            $t->string('description', 255)->nullable();
            $t->enum('type', ['input','select','checkbox','checkboxes','options','textbox']);
            $t->text('values')->nullable();
            $t->boolean('is_required')->default(0);
            $t->integer('field_order')->nullable();
            $t->boolean('show_in_order')->default(0);
            $t->boolean('show_in_clientarea')->default(0);
            $t->boolean('show_in_invoice')->default(0);
            $t->boolean('client_editable')->default(1);
            $t->timestamp('created_at')->nullable();
            $t->timestamp('updated_at')->nullable();
        });
    }

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