namespace ControlPlane.Core.Models; /// /// The fully-resolved network addresses for one infrastructure component for a specific tenant. /// Built by ProvisioningWorker at job start from StackConfig + ClarityInfraOptions. /// Carried through SagaContext and persisted in TenantRecord at saga completion. /// /// Design principle: Clarity.Server always talks to PublicUrl (goes through nginx/dnsmasq). /// The Worker uses AdminUrl (direct host-accessible URL) for admin API calls during provisioning. /// InternalUrl is injected into container env vars for container-to-container communication. /// public sealed record ResolvedEndpoint { /// Mode elected for this component. public ComponentMode Mode { get; init; } /// /// URL the Worker process uses to call this component's admin API. /// Worker runs on the host machine: /// SharedPlatform → http://localhost:{exposedPort} (docker-compose exposes to host) /// OwnContainer → http://localhost:{ephemeralPort} (resolved by InfrastructureProvisioningStep) /// VPS → operator-supplied external URL /// public string AdminUrl { get; init; } = string.Empty; /// /// Public DNS URL injected into Clarity.Server and surfaced in the TenantRecord. /// Always routes through nginx/dnsmasq — no direct Docker DNS leaks to app code. /// SharedPlatform → https://keycloak.clarity.test /// OwnContainer → https://kc.{subdomain}.clarity.test /// public string PublicUrl { get; init; } = string.Empty; /// /// Docker-internal URL for container-to-container communication on the managed network. /// SharedPlatform → http://keycloak:8080 /// OwnContainer → http://kc-{subdomain}:8080 /// public string InternalUrl { get; init; } = string.Empty; /// Docker container name, if the Worker manages this component. public string? ContainerName { get; init; } /// /// Admin username for this component instance. /// Null for SharedPlatform (read from Keycloak:AdminUser config at call time). /// Explicitly set for OwnContainer sidecars. /// public string? AdminUser { get; init; } /// Admin password for this component instance. See AdminUser. public string? AdminPassword { get; init; } }