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;

/// ViolationInfo : Provides information about the Policy violation info for this request.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ViolationInfo {
    /// Optional. Value that is being checked for the policy. This could be in encrypted form (if pii sensitive). This field will only be emitted in LIST_POLICY types
    #[serde(rename = "checkedValue", skip_serializing_if = "Option::is_none")]
    pub checked_value: Option<String>,
    /// Optional. Constraint name
    #[serde(rename = "constraint", skip_serializing_if = "Option::is_none")]
    pub constraint: Option<String>,
    /// Optional. Error message that policy is indicating.
    #[serde(rename = "errorMessage", skip_serializing_if = "Option::is_none")]
    pub error_message: Option<String>,
    /// Optional. Indicates the type of the policy.
    #[serde(rename = "policyType", skip_serializing_if = "Option::is_none")]
    pub policy_type: Option<PolicyType>,
}

impl ViolationInfo {
    /// Provides information about the Policy violation info for this request.
    pub fn new() -> ViolationInfo {
        ViolationInfo {
            checked_value: None,
            constraint: None,
            error_message: None,
            policy_type: None,
        }
    }
}
/// Optional. Indicates the type of the policy.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum PolicyType {
    #[serde(rename = "POLICY_TYPE_UNSPECIFIED")]
    PolicyTypeUnspecified,
    #[serde(rename = "BOOLEAN_CONSTRAINT")]
    BooleanConstraint,
    #[serde(rename = "LIST_CONSTRAINT")]
    ListConstraint,
    #[serde(rename = "CUSTOM_CONSTRAINT")]
    CustomConstraint,
}

impl Default for PolicyType {
    fn default() -> PolicyType {
        Self::PolicyTypeUnspecified
    }
}
