// Generated by openapi-moonbit — DO NOT EDIT
// Spec SHA-256: 7e574664c0f434e52021e12f313a3266fd3175fe2ecddde4c0e0930549c72ba2

///|
/// Authentication strategy applied to client requests.
#derive(Debug, Eq)
pub(all) enum Auth {
  /// No authentication credentials.
  None
  /// HTTP `Authorization: Bearer `.
  Bearer(String)
  /// HTTP `Authorization: Basic `.
  Basic(username~ : String, password~ : String)
  /// API key sent in a request header.
  ApiKeyHeader(name~ : String, value~ : String)
  /// API key appended as a query parameter.
  ApiKeyQuery(name~ : String, value~ : String)
  /// API key sent in the `Cookie` header.
  ApiKeyCookie(name~ : String, value~ : String)
  /// Apply multiple authentication schemes together (AND security requirements).
  Combined(Array[Auth])
}

///|
/// Credentials for OpenAPI security scheme `Cookie`.
pub fn Auth::cookie(value : String) -> Auth {
  Auth::ApiKeyCookie(name="GOLEM_SESSION", value~)
}

///|
/// Credentials for OpenAPI security scheme `Token`.
pub fn Auth::token(token : String) -> Auth {
  Auth::Bearer(token)
}

///|
/// Configuration shared by all operations on a client instance.
#derive(Debug, Eq)
pub(all) struct ClientConfig {
  /// Base service URL (e.g. `https://api.example.com`).
  base_url : String
  /// Authentication credentials.
  auth : Auth
  /// Default headers sent on every request unless overridden.
  default_headers : @runtime.Headers
}

///|
/// Construct a `ClientConfig` with defaults from the OpenAPI spec.
pub fn ClientConfig::new(
  base_url~ : String = "https://release.api.golem.cloud",
  auth~ : Auth = Auth::None,
  default_headers? : @runtime.Headers,
) -> ClientConfig {
  let headers = match default_headers {
    Option::Some(h) => h.copy()
    Option::None => @runtime.Headers::new()
  }
  { base_url, auth, default_headers: headers, }
}