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;

/// QuotaError : Represents error information for QuotaOperation.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct QuotaError {
    /// Error code.
    #[serde(rename = "code", skip_serializing_if = "Option::is_none")]
    pub code: Option<Code>,
    /// Free-form text that provides details on the cause of the error.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: 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 enum for more details on this field. For example, \"clientip:\" or \"project:\".
    #[serde(rename = "subject", skip_serializing_if = "Option::is_none")]
    pub subject: Option<String>,
}

impl QuotaError {
    /// Represents error information for QuotaOperation.
    pub fn new() -> QuotaError {
        QuotaError {
            code: None,
            description: None,
            status: None,
            subject: None,
        }
    }
}
/// Error code.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Code {
    #[serde(rename = "UNSPECIFIED")]
    Unspecified,
    #[serde(rename = "RESOURCE_EXHAUSTED")]
    ResourceExhausted,
    #[serde(rename = "OUT_OF_RANGE")]
    OutOfRange,
    #[serde(rename = "BILLING_NOT_ACTIVE")]
    BillingNotActive,
    #[serde(rename = "PROJECT_DELETED")]
    ProjectDeleted,
    #[serde(rename = "API_KEY_INVALID")]
    ApiKeyInvalid,
    #[serde(rename = "API_KEY_EXPIRED")]
    ApiKeyExpired,
    #[serde(rename = "SPATULA_HEADER_INVALID")]
    SpatulaHeaderInvalid,
    #[serde(rename = "LOAS_ROLE_INVALID")]
    LoasRoleInvalid,
    #[serde(rename = "NO_LOAS_PROJECT")]
    NoLoasProject,
    #[serde(rename = "PROJECT_STATUS_UNAVAILABLE")]
    ProjectStatusUnavailable,
    #[serde(rename = "SERVICE_STATUS_UNAVAILABLE")]
    ServiceStatusUnavailable,
    #[serde(rename = "BILLING_STATUS_UNAVAILABLE")]
    BillingStatusUnavailable,
    #[serde(rename = "QUOTA_SYSTEM_UNAVAILABLE")]
    QuotaSystemUnavailable,
}

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