using System.ComponentModel.DataAnnotations;
namespace Heimdall.Agent;
///
/// Strongly-typed configuration for the Heimdall Agent.
/// Bound from environment variables or appsettings.json on startup.
/// Validated automatically — misconfiguration is caught before any service runs.
///
public sealed class AgentOptions
{
public const string SectionName = "Agent";
/// URL of the Heimdall Central server (e.g. http://heimdall-central:8080).
[Required, Url]
public string CentralUrl { get; init; } = string.Empty;
/// Site token for agent registration.
[Required, MinLength(1)]
public string SiteToken { get; init; } = string.Empty;
///
/// Display name for this agent instance. Falls back to hostname if empty.
///
public string? AgentName { get; init; }
/// Interval between heartbeats in seconds (default: 30).
[Range(5, 300)]
public int HeartbeatIntervalSeconds { get; init; } = 30;
/// Directory for persisting agent identity state. Defaults to /var/lib/heimdall on Linux.
public string? StateDirectory { get; init; }
/// Max retries for agent registration (default: 5).
[Range(1, 20)]
public int RegistrationMaxRetries { get; init; } = 5;
/// Interval between automatic camera network scans in seconds (default: 900 = 15 min).
[Range(60, 86400)]
public int DiscoveryIntervalSeconds { get; init; } = 900;
/// Enable automatic camera discovery on the local network (default: true).
public bool DiscoveryEnabled { get; init; } = true;
/// Agent software version reported to Central.
public string Version { get; init; } = "1.0.0";
///
/// Local camera assignments used as a fallback until the Central ships its
/// camera list (per-agent settings pipeline). Useful for development or
/// agents that cannot reach the Central camera registry. When the Central
/// config arrives, it replaces this list entirely.
///
public List Cameras { get; init; } = [];
}