use serde::{Deserialize, Serialize}; /*
                                      * Compute Engine API
                                      *
                                      * Creates and runs virtual machines on Google Cloud Platform.
                                      *
                                      * The version of the OpenAPI document: v1
                                      *
                                      * Generated by: https://openapi-generator.tech
                                      */

/// PacketIntervals : Next free: 7

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct PacketIntervals {
    /// Average observed inter-packet interval in milliseconds.
    #[serde(rename = "avgMs", skip_serializing_if = "Option::is_none")]
    pub avg_ms: Option<String>,
    /// From how long ago in the past these intervals were observed.
    #[serde(rename = "duration", skip_serializing_if = "Option::is_none")]
    pub duration: Option<Duration>,
    /// Maximum observed inter-packet interval in milliseconds.
    #[serde(rename = "maxMs", skip_serializing_if = "Option::is_none")]
    pub max_ms: Option<String>,
    /// Minimum observed inter-packet interval in milliseconds.
    #[serde(rename = "minMs", skip_serializing_if = "Option::is_none")]
    pub min_ms: Option<String>,
    /// Number of inter-packet intervals from which these statistics were derived.
    #[serde(rename = "numIntervals", skip_serializing_if = "Option::is_none")]
    pub num_intervals: Option<String>,
    /// The type of packets for which inter-packet intervals were computed.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<Type>,
}

impl PacketIntervals {
    /// Next free: 7
    pub fn new() -> PacketIntervals {
        PacketIntervals {
            avg_ms: None,
            duration: None,
            max_ms: None,
            min_ms: None,
            num_intervals: None,
            r#type: None,
        }
    }
}

/// From how long ago in the past these intervals were observed.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Duration {
    #[serde(rename = "DURATION_UNSPECIFIED")]
    DurationUnspecified,
    #[serde(rename = "HOUR")]
    Hour,
    #[serde(rename = "MAX")]
    Max,
    #[serde(rename = "MINUTE")]
    Minute,
}

impl Default for Duration {
    fn default() -> Duration {
        Self::DurationUnspecified
    }
}
/// The type of packets for which inter-packet intervals were computed.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "LOOPBACK")]
    Loopback,
    #[serde(rename = "RECEIVE")]
    Receive,
    #[serde(rename = "TRANSMIT")]
    Transmit,
    #[serde(rename = "TYPE_UNSPECIFIED")]
    TypeUnspecified,
}

impl Default for Type {
    fn default() -> Type {
        Self::Loopback
    }
}
