<?php

namespace Database\Factories;

use App\Models\Bug;
use App\Models\FotoBug;
use Illuminate\Database\Eloquent\Factories\Factory;

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

    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'titulo' => $this->faker->sentence(4),
            'descripcion' => $this->faker->paragraph(),
            'prioridad' => $this->faker->randomElement(['baja', 'media', 'alta']),
            'estado' => $this->faker->randomElement(['abierto', 'en progreso', 'cerrado']),
            'version' => $this->faker->regexify('[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}'),
            'fotobug_id' => $this->faker->optional()->then(fn () => FotoBug::factory()),
        ];
    }
}
