namespace ZB.MOM.WW.MxGateway.Server.Security.Authorization;

/// <summary>
/// Partition identity for the API-key failure limiter: the transport peer that sent the request and,
/// when the presented token is validly shaped, the key id it claims.
/// </summary>
/// <remarks>
/// Both halves come from unauthenticated input, which is why neither may stand alone. The transport
/// peer is always present, so a throttle can never outlive the address that earned it; the key id is
/// present only after the shape check in
/// <see cref="GatewayGrpcAuthorizationInterceptor"/> (literal <c>mxgw</c> prefix, at least three
/// non-empty underscore segments, bounded key-id length) so junk tokens cannot mint partitions.
/// </remarks>
/// <param name="TransportPeer">The gRPC transport peer address (<c>ServerCallContext.Peer</c>).</param>
/// <param name="KeyId">The key id claimed by a validly shaped token, or <see langword="null"/>.</param>
public readonly record struct ApiKeyThrottlePartition(string TransportPeer, string? KeyId);
