use serde::{Deserialize, Serialize}; /*
                                      * Service Control API
                                      *
                                      * Provides admission control and telemetry reporting for services integrated with Service Infrastructure.
                                      *
                                      * The version of the OpenAPI document: v1
                                      *
                                      * Generated by: https://openapi-generator.tech
                                      */

use crate::google_rest_apis::servicecontrol_v1::models;

/// CheckError : Defines the errors to be returned in google.api.servicecontrol.v1.CheckResponse.check_errors.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CheckError {
    /// The error code.
    #[serde(rename = "code", skip_serializing_if = "Option::is_none")]
    pub code: Option<Code>,
    /// Free-form text providing details on the error cause of the error.
    #[serde(rename = "detail", skip_serializing_if = "Option::is_none")]
    pub detail: Option<String>,
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Box<models::Status>>,
    /// Subject to whom this error applies. See the specific code enum for more details on this field. For example: - \"project:\" - \"folder:\" - \"organization:\"
    #[serde(rename = "subject", skip_serializing_if = "Option::is_none")]
    pub subject: Option<String>,
}

impl CheckError {
    /// Defines the errors to be returned in google.api.servicecontrol.v1.CheckResponse.check_errors.
    pub fn new() -> CheckError {
        CheckError {
            code: None,
            detail: None,
            status: None,
            subject: None,
        }
    }
}
/// The error code.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Code {
    #[serde(rename = "ERROR_CODE_UNSPECIFIED")]
    ErrorCodeUnspecified,
    #[serde(rename = "NOT_FOUND")]
    NotFound,
    #[serde(rename = "PERMISSION_DENIED")]
    PermissionDenied,
    #[serde(rename = "RESOURCE_EXHAUSTED")]
    ResourceExhausted,
    #[serde(rename = "BUDGET_EXCEEDED")]
    BudgetExceeded,
    #[serde(rename = "DENIAL_OF_SERVICE_DETECTED")]
    DenialOfServiceDetected,
    #[serde(rename = "LOAD_SHEDDING")]
    LoadShedding,
    #[serde(rename = "ABUSER_DETECTED")]
    AbuserDetected,
    #[serde(rename = "SERVICE_NOT_ACTIVATED")]
    ServiceNotActivated,
    #[serde(rename = "VISIBILITY_DENIED")]
    VisibilityDenied,
    #[serde(rename = "BILLING_DISABLED")]
    BillingDisabled,
    #[serde(rename = "PROJECT_DELETED")]
    ProjectDeleted,
    #[serde(rename = "PROJECT_INVALID")]
    ProjectInvalid,
    #[serde(rename = "CONSUMER_INVALID")]
    ConsumerInvalid,
    #[serde(rename = "IP_ADDRESS_BLOCKED")]
    IpAddressBlocked,
    #[serde(rename = "REFERER_BLOCKED")]
    RefererBlocked,
    #[serde(rename = "CLIENT_APP_BLOCKED")]
    ClientAppBlocked,
    #[serde(rename = "API_TARGET_BLOCKED")]
    ApiTargetBlocked,
    #[serde(rename = "API_KEY_INVALID")]
    ApiKeyInvalid,
    #[serde(rename = "API_KEY_EXPIRED")]
    ApiKeyExpired,
    #[serde(rename = "API_KEY_NOT_FOUND")]
    ApiKeyNotFound,
    #[serde(rename = "SPATULA_HEADER_INVALID")]
    SpatulaHeaderInvalid,
    #[serde(rename = "LOAS_ROLE_INVALID")]
    LoasRoleInvalid,
    #[serde(rename = "NO_LOAS_PROJECT")]
    NoLoasProject,
    #[serde(rename = "LOAS_PROJECT_DISABLED")]
    LoasProjectDisabled,
    #[serde(rename = "SECURITY_POLICY_VIOLATED")]
    SecurityPolicyViolated,
    #[serde(rename = "INVALID_CREDENTIAL")]
    InvalidCredential,
    #[serde(rename = "LOCATION_POLICY_VIOLATED")]
    LocationPolicyViolated,
    #[serde(rename = "NAMESPACE_LOOKUP_UNAVAILABLE")]
    NamespaceLookupUnavailable,
    #[serde(rename = "SERVICE_STATUS_UNAVAILABLE")]
    ServiceStatusUnavailable,
    #[serde(rename = "BILLING_STATUS_UNAVAILABLE")]
    BillingStatusUnavailable,
    #[serde(rename = "QUOTA_CHECK_UNAVAILABLE")]
    QuotaCheckUnavailable,
    #[serde(rename = "LOAS_PROJECT_LOOKUP_UNAVAILABLE")]
    LoasProjectLookupUnavailable,
    #[serde(rename = "CLOUD_RESOURCE_MANAGER_BACKEND_UNAVAILABLE")]
    CloudResourceManagerBackendUnavailable,
    #[serde(rename = "SECURITY_POLICY_BACKEND_UNAVAILABLE")]
    SecurityPolicyBackendUnavailable,
    #[serde(rename = "LOCATION_POLICY_BACKEND_UNAVAILABLE")]
    LocationPolicyBackendUnavailable,
    #[serde(rename = "INJECTED_ERROR")]
    InjectedError,
}

impl Default for Code {
    fn default() -> Code {
        Self::ErrorCodeUnspecified
    }
}
