namespace Gateway.Security;
///
/// Holds authenticated identity information for the current request.
/// Populated by MultiProviderAuthMiddleware.
///
public sealed class ClientContext
{
public string? SessionId { get; set; }
public string? ClientId { get; set; } // OID (JWT) or platform client ID (session)
public string? TenantId { get; set; }
public string? ClientName { get; set; }
public string? ClientCategory { get; set; }
public string? UserId { get; set; }
public string? Email { get; set; }
public string? Role { get; set; }
public bool IsDevBypass { get; set; }
public string? AuthProvider { get; set; }
///
/// Raw Entra Object ID (oid claim) — always set for Microsoft tokens.
/// Used for identity and activity logging. Distinct from ClientId which may fall
/// back to sub for tokens where oid isn't surfaced as a named claim.
///
public string? EntraOid { get; set; }
///
/// True when the token was issued by the standard Entra (staff) tenant.
///
public bool IsStaff { get; set; }
/// True if we have a valid ClientId.
public bool IsAuthenticated => !string.IsNullOrWhiteSpace(ClientId);
/// True if this is an admin session (IsStaff + Role set).
public bool IsAdmin => IsStaff && !string.IsNullOrWhiteSpace(Role);
}