<?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::create('work_calendars', function (Blueprint $table) {
            $table->id();
            $table->date('date')->unique();
            $table->enum('type', array_column(\App\Enums\WorkDayType::cases(), 'value'));
            $table->enum('data_source', array_column(\App\Enums\DataSource::cases(), 'value'))->default(\App\Enums\DataSource::Manual->value);
            $table->text('description')->nullable();

            // Audit mezők a BaseAuditable-hoz
            $table->unsignedBigInteger('created_by')->nullable();
            $table->unsignedBigInteger('updated_by')->nullable();
            $table->unsignedBigInteger('deleted_by')->nullable();
            $table->timestamps();
            $table->softDeletes();

            $table->index('date');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('work_calendars');
    }
};
