<?php

namespace Modules\HR\Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Modules\Core\Database\Seeders\Traits\DisableForeignKeys;
use Modules\Core\Enums\StatusEnum;
use Modules\HR\Models\Holiday;
use Modules\HR\Models\HolidayGroup;

class HolidaySeeder extends Seeder
{
    use DisableForeignKeys, WithoutModelEvents;

    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $this->disableForeignKeys();

        DB::table('holidays')->truncate();

        $regularGroupId = HolidayGroup::where('name', 'Regular Full-Time Staff')->first()?->id;

        Holiday::insert([
            [
                'holiday_group_id' => $regularGroupId,
                'title'            => 'International Mother Language Day',
                'holiday_date'     => '2026-02-21',
                'is_optional'      => false,
                'remarks'          => 'National Holiday',
                'status'           => StatusEnum::ACTIVE,
                'created_at'       => now(),
                'updated_at'       => now(),
            ],
            [
                'holiday_group_id' => $regularGroupId,
                'title'            => 'Independence Day of Bangladesh',
                'holiday_date'     => '2026-03-26',
                'is_optional'      => false,
                'remarks'          => 'National Holiday',
                'status'           => StatusEnum::ACTIVE,
                'created_at'       => now(),
                'updated_at'       => now(),
            ],
            [
                'holiday_group_id' => $regularGroupId,
                'title'            => 'May Day',
                'holiday_date'     => '2026-05-01',
                'is_optional'      => false,
                'remarks'          => 'International Workers Day',
                'status'           => StatusEnum::ACTIVE,
                'created_at'       => now(),
                'updated_at'       => now(),
            ],

        ]);

        $this->enableForeignKeys();
    }
}
