<?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::table('tenant_user_profiles', function (Blueprint $table) {
            // 인덱싱 필요한 필드만 컬럼으로 추가
            $table->enum('employee_status', ['active', 'leave', 'resigned'])
                ->default('active')
                ->after('employment_type_key')
                ->comment('고용상태: active(재직), leave(휴직), resigned(퇴직)');

            // 복합 인덱스 추가
            $table->index(['tenant_id', 'employee_status'], 'idx_tenant_employee_status');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('tenant_user_profiles', function (Blueprint $table) {
            $table->dropIndex('idx_tenant_employee_status');
            $table->dropColumn('employee_status');
        });
    }
};
