<?php

namespace Database\Factories;

use App\Models\Agent;
use App\Models\Website;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends Factory<Agent>
 */
class AgentFactory extends Factory
{
    protected $model = Agent::class;

    public function definition(): array
    {
        return [
            'website_id' => Website::factory(),
            'version' => 'v'.fake()->numberBetween(1, 3).'.'.fake()->numberBetween(0, 9).'.'.fake()->numberBetween(0, 9),
            'status' => fake()->randomElement(['online', 'offline', 'degraded']),
            'authentication_status' => fake()->randomElement(['verified', 'expired', 'pending']),
            'sync_status' => fake()->randomElement(['synced', 'stale', 'pending']),
            'latency_ms' => fake()->numberBetween(85, 1250),
            'last_heartbeat_at' => now()->subMinutes(fake()->numberBetween(1, 120)),
            'capabilities' => ['health', 'tables', 'backup'],
            'heartbeat_payload' => [
                'php_version' => '8.2',
                'laravel_version' => '12.x',
            ],
        ];
    }
}
