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
                                      */

/// BfdStatus : Next free: 15

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct BfdStatus {
    /// The BFD session initialization mode for this BGP peer. If set to ACTIVE, the Cloud Router will initiate the BFD session for this BGP peer. If set to PASSIVE, the Cloud Router will wait for the peer router to initiate the BFD session for this BGP peer. If set to DISABLED, BFD is disabled for this BGP peer.
    #[serde(
        rename = "bfdSessionInitializationMode",
        skip_serializing_if = "Option::is_none"
    )]
    pub bfd_session_initialization_mode: Option<BfdSessionInitializationMode>,
    /// Unix timestamp of the most recent config update.
    #[serde(
        rename = "configUpdateTimestampMicros",
        skip_serializing_if = "Option::is_none"
    )]
    pub config_update_timestamp_micros: Option<String>,
    #[serde(
        rename = "controlPacketCounts",
        skip_serializing_if = "Option::is_none"
    )]
    pub control_packet_counts:
        Option<Box<crate::google_rest_apis::compute_v1::models::BfdStatusPacketCounts>>,
    /// Inter-packet time interval statistics for control packets.
    #[serde(
        rename = "controlPacketIntervals",
        skip_serializing_if = "Option::is_none"
    )]
    pub control_packet_intervals:
        Option<Vec<crate::google_rest_apis::compute_v1::models::PacketIntervals>>,
    /// The diagnostic code specifies the local system's reason for the last change in session state. This allows remote systems to determine the reason that the previous session failed, for example. These diagnostic codes are specified in section 4.1 of RFC5880
    #[serde(rename = "localDiagnostic", skip_serializing_if = "Option::is_none")]
    pub local_diagnostic: Option<LocalDiagnostic>,
    /// The current BFD session state as seen by the transmitting system. These states are specified in section 4.1 of RFC5880
    #[serde(rename = "localState", skip_serializing_if = "Option::is_none")]
    pub local_state: Option<LocalState>,
    /// Negotiated transmit interval for control packets.
    #[serde(
        rename = "negotiatedLocalControlTxIntervalMs",
        skip_serializing_if = "Option::is_none"
    )]
    pub negotiated_local_control_tx_interval_ms: Option<i32>,
    #[serde(rename = "rxPacket", skip_serializing_if = "Option::is_none")]
    pub rx_packet: Option<Box<crate::google_rest_apis::compute_v1::models::BfdPacket>>,
    #[serde(rename = "txPacket", skip_serializing_if = "Option::is_none")]
    pub tx_packet: Option<Box<crate::google_rest_apis::compute_v1::models::BfdPacket>>,
    /// Session uptime in milliseconds. Value will be 0 if session is not up.
    #[serde(rename = "uptimeMs", skip_serializing_if = "Option::is_none")]
    pub uptime_ms: Option<String>,
}

impl BfdStatus {
    /// Next free: 15
    pub fn new() -> BfdStatus {
        BfdStatus {
            bfd_session_initialization_mode: None,
            config_update_timestamp_micros: None,
            control_packet_counts: None,
            control_packet_intervals: None,
            local_diagnostic: None,
            local_state: None,
            negotiated_local_control_tx_interval_ms: None,
            rx_packet: None,
            tx_packet: None,
            uptime_ms: None,
        }
    }
}

/// The BFD session initialization mode for this BGP peer. If set to ACTIVE, the Cloud Router will initiate the BFD session for this BGP peer. If set to PASSIVE, the Cloud Router will wait for the peer router to initiate the BFD session for this BGP peer. If set to DISABLED, BFD is disabled for this BGP peer.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum BfdSessionInitializationMode {
    #[serde(rename = "ACTIVE")]
    Active,
    #[serde(rename = "DISABLED")]
    Disabled,
    #[serde(rename = "PASSIVE")]
    Passive,
}

impl Default for BfdSessionInitializationMode {
    fn default() -> BfdSessionInitializationMode {
        Self::Active
    }
}
/// The diagnostic code specifies the local system's reason for the last change in session state. This allows remote systems to determine the reason that the previous session failed, for example. These diagnostic codes are specified in section 4.1 of RFC5880
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum LocalDiagnostic {
    #[serde(rename = "ADMINISTRATIVELY_DOWN")]
    AdministrativelyDown,
    #[serde(rename = "CONCATENATED_PATH_DOWN")]
    ConcatenatedPathDown,
    #[serde(rename = "CONTROL_DETECTION_TIME_EXPIRED")]
    ControlDetectionTimeExpired,
    #[serde(rename = "DIAGNOSTIC_UNSPECIFIED")]
    DiagnosticUnspecified,
    #[serde(rename = "ECHO_FUNCTION_FAILED")]
    EchoFunctionFailed,
    #[serde(rename = "FORWARDING_PLANE_RESET")]
    ForwardingPlaneReset,
    #[serde(rename = "NEIGHBOR_SIGNALED_SESSION_DOWN")]
    NeighborSignaledSessionDown,
    #[serde(rename = "NO_DIAGNOSTIC")]
    NoDiagnostic,
    #[serde(rename = "PATH_DOWN")]
    PathDown,
    #[serde(rename = "REVERSE_CONCATENATED_PATH_DOWN")]
    ReverseConcatenatedPathDown,
}

impl Default for LocalDiagnostic {
    fn default() -> LocalDiagnostic {
        Self::AdministrativelyDown
    }
}
/// The current BFD session state as seen by the transmitting system. These states are specified in section 4.1 of RFC5880
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum LocalState {
    #[serde(rename = "ADMIN_DOWN")]
    AdminDown,
    #[serde(rename = "DOWN")]
    Down,
    #[serde(rename = "INIT")]
    Init,
    #[serde(rename = "STATE_UNSPECIFIED")]
    StateUnspecified,
    #[serde(rename = "UP")]
    Up,
}

impl Default for LocalState {
    fn default() -> LocalState {
        Self::AdminDown
    }
}
