<?php

namespace Database\Factories;

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

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\TicketStatus>
 */
class TicketStatusFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var string
     */
    protected $model = TicketStatus::class;

    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'name' => $this->faker->randomElement([
                'Açık', 'Yanıtlandı', 'Müşteri Cevabı', 'Beklemede',
                'İnceleniyor', 'Çözüldü', 'Kapalı', 'İptal Edildi',
            ]),
            'slug' => $this->faker->unique()->slug(),
            'color' => $this->faker->randomElement([
                '#28a745', '#007bff', '#ffc107', '#6c757d',
                '#dc3545', '#17a2b8', '#6f42c1', '#fd7e14',
            ]),
            'is_closed' => $this->faker->boolean(20), // %20 kapalı
            'is_default' => false, // Sadece bir tane default olmalı
            'sort_order' => $this->faker->numberBetween(1, 10),
            'status' => $this->faker->boolean(90), // %90 aktif
        ];
    }

    /**
     * Default durum
     */
    public function default(): static
    {
        return $this->state(fn (array $attributes) => [
            'is_default' => true,
            'is_closed' => false,
        ]);
    }

    /**
     * Kapalı durum
     */
    public function closed(): static
    {
        return $this->state(fn (array $attributes) => [
            'is_closed' => true,
            'is_default' => false,
        ]);
    }

    /**
     * Pasif durum
     */
    public function inactive(): static
    {
        return $this->state(fn (array $attributes) => [
            'status' => false,
        ]);
    }
}
