/*
 * This is an auto-generated file.
 * Any manual changes may be overwritten without notice!
 */

use derive_builder::Builder;
use serde::{Deserialize, Serialize};

/// ACLAuthMethodConfig is used to store configuration of an auth method.
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct ACLAuthMethodConfig {
    /// List of OIDC scopes
    #[serde(
        rename = "OIDCScopes",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub oidc_scopes: Vec<String>,

    /// The value against which to match the iss claim in a JWT
    #[serde(
        rename = "BoundIssuer",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub bound_issuer: Vec<String>,

    /// PEM encoded CA certs for use by the TLS client used to talk with the
    /// OIDC Discovery URL.
    #[serde(
        rename = "DiscoveryCaPem",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub discovery_ca_pem: Vec<String>,

    /// Duration in seconds of leeway when validating all claims to account for
    /// clock skew.
    #[serde(
        rename = "ClockSkewLeeway",
        serialize_with = "crate::serialize_duration",
        deserialize_with = "crate::deserialize_duration"
    )]
    pub clock_skew_leeway: chrono::TimeDelta,

    /// Mappings of claims (key) that will be copied to a metadata field
    /// (value).
    #[serde(rename = "ClaimMappings")]
    pub claim_mappings: std::collections::HashMap<String, String>,

    /// A list of PEM-encoded public keys to use to authenticate signatures
    /// locally
    #[serde(
        rename = "JWTValidationPubKeys",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub jwt_validation_pub_keys: Vec<String>,

    /// Disable claims from the OIDC UserInfo endpoint
    #[serde(rename = "OIDCDisableUserInfo")]
    pub oidc_disable_user_info: bool,

    /// Duration in seconds of leeway when validating expiration of a token to
    /// account for clock skew
    #[serde(
        rename = "ExpirationLeeway",
        serialize_with = "crate::serialize_duration",
        deserialize_with = "crate::deserialize_duration"
    )]
    pub expiration_leeway: chrono::TimeDelta,

    /// The OIDC Discovery URL, without any .well-known component (base path)
    #[serde(rename = "OIDCDiscoveryURL")]
    pub oidc_discovery_url: String,

    /// A list of allowed values for redirect_uri
    #[serde(
        rename = "AllowedRedirectURIs",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub allowed_redirect_ur_is: Vec<String>,

    /// List of auth claims that are valid for login
    #[serde(
        rename = "BoundAudiences",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub bound_audiences: Vec<String>,

    /// PEM encoded CA cert for use by the TLS client used to talk with the JWKS
    /// URL
    #[serde(rename = "JWKSCACert")]
    pub jwksca_cert: String,

    /// Duration in seconds of leeway when validating not before values of a
    /// token to account for clock skew.
    #[serde(
        rename = "NotBeforeLeeway",
        serialize_with = "crate::serialize_duration",
        deserialize_with = "crate::deserialize_duration"
    )]
    pub not_before_leeway: chrono::TimeDelta,

    #[serde(rename = "ListClaimMappings")]
    pub list_claim_mappings: std::collections::HashMap<String, String>,

    /// The OAuth Client ID configured with the OIDC provider
    #[serde(rename = "OIDCClientID")]
    pub oidc_client_id: String,

    /// The OAuth Client Secret configured with the OIDC provider
    #[serde(rename = "OIDCClientSecret")]
    pub oidc_client_secret: String,

    /// JSON Web Key Sets url for authenticating signatures
    #[serde(rename = "JWKSURL")]
    pub jwksurl: String,

    /// A list of supported signing algorithms
    #[serde(
        rename = "SigningAlgs",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub signing_algs: Vec<String>,
}
