<?php

declare(strict_types=1);

namespace Maestro\Core\Modules\HourRegistration\Database\Seeders;

use Illuminate\Database\Seeder;
use Maestro\Core\Modules\HourRegistration\Models\HourInternalCategory;

/**
 * Seeds default hour-registration reference data (extensible categories).
 */
class HourRegistrationSeeder extends Seeder
{
    public function run(): void
    {
        $definitions = [
            ['name' => 'Sick leave', 'slug' => 'sick', 'sort_order' => 10],
            ['name' => 'Vacation', 'slug' => 'vacation', 'sort_order' => 20],
            ['name' => 'Training', 'slug' => 'training', 'sort_order' => 30],
            ['name' => 'Administrative internal', 'slug' => 'admin-internal', 'sort_order' => 40],
        ];

        foreach ($definitions as $row) {
            HourInternalCategory::query()->updateOrCreate(
                ['slug' => $row['slug']],
                [
                    'name' => $row['name'],
                    'sort_order' => $row['sort_order'],
                    'is_active' => true,
                ],
            );
        }
    }
}
