<?php

namespace Database\Factories;

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

/**
 * @extends Factory<Website>
 */
class WebsiteFactory extends Factory
{
    protected $model = Website::class;

    public function definition(): array
    {
        return [
            'created_by' => User::factory(),
            'name' => fake()->company().' Hub',
            'domain' => fake()->unique()->domainName(),
            'connection_type' => fake()->randomElement(['api_agent', 'custom_agent']),
            'api_endpoint' => 'https://'.fake()->unique()->domainName().'/api/control-center-agent',
            'api_key' => 'cc_'.fake()->regexify('[A-Za-z0-9]{24}'),
            'signing_secret' => fake()->sha256(),
            'description' => fake()->sentence(10),
            'status' => fake()->randomElement(['online', 'offline', 'degraded', 'disabled', 'pending']),
            'health_status' => fake()->randomElement(['healthy', 'warning', 'critical', 'unknown']),
            'database_count' => fake()->numberBetween(1, 6),
            'table_count' => fake()->numberBetween(12, 140),
            'response_time_ms' => fake()->numberBetween(90, 1100),
            'last_seen_at' => now()->subMinutes(fake()->numberBetween(2, 180)),
            'last_synced_at' => now()->subMinutes(fake()->numberBetween(5, 300)),
        ];
    }
}
