<?php

declare(strict_types=1);

namespace Database\Factories;

use App\Models\SlaPolicy;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\SlaPolicy>
 */
class SlaPolicyFactory extends Factory
{
    protected $model = SlaPolicy::class;

    /** @return array<string, mixed> */
    public function definition(): array
    {
        return [
            'name' => fake()->words(3, true).' SLA',
            'priority' => fake()->randomElement(['low', 'medium', 'high', 'urgent']),
            'first_response_hours' => fake()->randomElement([1, 2, 4, 8, 24]),
            'resolution_hours' => fake()->randomElement([8, 24, 48, 72]),
            'business_hours_only' => fake()->boolean(70),
        ];
    }

    public function urgent(): static
    {
        return $this->state(fn (array $attributes): array => [
            'priority' => 'urgent',
            'first_response_hours' => 1,
            'resolution_hours' => 4,
        ]);
    }
}
