import Foundation
public enum HTTPMethod: String, Sendable, Hashable, CaseIterable {
case get = "GET", post = "POST", put = "PUT", patch = "PATCH", delete = "DELETE"
}
/// Which credentials an operation accepts, as declared by the spec.
public enum IrdSecurity: Sendable, Hashable {
/// An API key or an account session (JWT).
case keyOrJwt
/// Only an account session; API keys answer 401.
case jwtOnly
/// No credentials; the client never sends its bearer.
case anonymous
/// Works without credentials; the bearer is sent when the client has one.
case anonymousOrKey
}
/// One API operation: the spec's method and path template plus the client's name for it.
public struct IrdOperation: Sendable, Hashable {
public let method: HTTPMethod
public let pathTemplate: String
public let module: String
public let name: String
public let security: IrdSecurity
public init(method: HTTPMethod, pathTemplate: String, module: String, name: String, security: IrdSecurity) {
self.method = method
self.pathTemplate = pathTemplate
self.module = module
self.name = name
self.security = security
}
/// `"METHOD /path/{template}"` — the key used by the domain gate and the coverage test.
public var key: String { "\(method.rawValue) \(pathTemplate)" }
}
/// One query-string pair. Unset fields never become items, so nothing is dropped later.
public struct QueryItem: Sendable, Hashable {
public let name: String
public let value: String
public init(_ name: String, _ value: String) { self.name = name; self.value = value }
}