<?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('holidays', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('tenant_id');
            $table->date('start_date')->comment('시작일');
            $table->date('end_date')->comment('종료일 (단일 휴일이면 start_date와 동일)');
            $table->string('name', 100)->comment('휴일명');
            $table->string('type', 30)->default('public')->comment('유형: public(공휴일), company(회사지정), etc');
            $table->boolean('is_recurring')->default(false)->comment('매년 반복 여부');
            $table->text('memo')->nullable()->comment('메모');
            $table->unsignedBigInteger('created_by')->nullable();
            $table->unsignedBigInteger('updated_by')->nullable();
            $table->timestamps();
            $table->softDeletes();

            $table->index(['tenant_id', 'start_date']);
            $table->index(['tenant_id', 'end_date']);
        });
    }

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