<?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('consulting_fees', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('tenant_id');
            $table->date('date');
            $table->string('consultant', 50);
            $table->string('customer', 100);
            $table->string('service', 50)->default('기술 컨설팅');
            $table->integer('hours')->default(0);
            $table->integer('hourly_rate')->default(0);
            $table->bigInteger('amount')->default(0);
            $table->string('status', 20)->default('pending');
            $table->text('memo')->nullable();
            $table->timestamps();
            $table->softDeletes();
            $table->index(['tenant_id', 'status']);
            $table->index(['tenant_id', 'date']);
        });
    }

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