<?php

namespace Database\Factories;

use App\Enums\LogLevelEnum;
use App\Models\Log;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends Factory<Log>
 */
class LogFactory extends Factory
{
    protected $model = Log::class;

    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'level' => fake()->randomElement(LogLevelEnum::cases()),
            'message' => fake()->sentence(),
            'context' => fake()->randomElement([
                [],
                ['key' => 'value'],
                ['error_code' => fake()->numberBetween(1000, 9999)],
                ['user_id' => fake()->numberBetween(1, 100)],
            ]),
        ];
    }
}
