<?php

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

/**
 * PRC-1143 — konsolide şema: `client_balance_types` tablosunun TAM tanımı (tek dosya).
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::create('client_balance_types', function (Blueprint $t) {
            $t->id();
            $t->string('name', 255);
            $t->string('code', 255);
            $t->text('description')->nullable();
            $t->boolean('is_positive')->default(1);
            $t->boolean('is_active')->default(1);
            $t->timestamp('created_at')->nullable();
            $t->timestamp('updated_at')->nullable();
            $t->index(['code', 'is_active'], 'client_balance_types_code_is_active_index');
            $t->unique('code', 'client_balance_types_code_unique');
        });
    }

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