<?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('company_id')->nullable(); // users.id of role_id=2
            $table->unsignedBigInteger('superadmin_id')->nullable();
            $table->string('holiday_name');
            $table->date('holiday_date');
            $table->enum('holiday_type', ['Full Day', 'Half Day'])->default('Full Day');
            $table->boolean('include_weekly_off')->default(false);
            // Selection By
            $table->string('selection_type')->default('all_company'); // all_company, few_company, few_branch, all_dept, few_dept, all_desig, few_desig, all_emp, few_emp
            $table->json('company_ids')->nullable();
            $table->json('branch_ids')->nullable();
            $table->json('department_ids')->nullable();
            $table->json('designation_ids')->nullable();
            $table->json('employee_ids')->nullable();
            $table->timestamps();
        });
    }

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