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

/// NetworkPeering : A network peering attached to a network resource. The message includes the peering name, peer network, peering state, and a flag indicating whether Google Compute Engine should automatically create routes for the peering.

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct NetworkPeering {
    /// This field will be deprecated soon. Use the exchange_subnet_routes field instead. Indicates whether full mesh connectivity is created and managed automatically between peered networks. Currently this field should always be true since Google Compute Engine will automatically create and manage subnetwork routes between two networks when peering state is ACTIVE.
    #[serde(rename = "autoCreateRoutes", skip_serializing_if = "Option::is_none")]
    pub auto_create_routes: Option<bool>,
    /// Indicates whether full mesh connectivity is created and managed automatically between peered networks. Currently this field should always be true since Google Compute Engine will automatically create and manage subnetwork routes between two networks when peering state is ACTIVE.
    #[serde(
        rename = "exchangeSubnetRoutes",
        skip_serializing_if = "Option::is_none"
    )]
    pub exchange_subnet_routes: Option<bool>,
    /// Whether to export the custom routes to peer network. The default value is false.
    #[serde(rename = "exportCustomRoutes", skip_serializing_if = "Option::is_none")]
    pub export_custom_routes: Option<bool>,
    /// Whether subnet routes with public IP range are exported. The default value is true, all subnet routes are exported. IPv4 special-use ranges are always exported to peers and are not controlled by this field.
    #[serde(
        rename = "exportSubnetRoutesWithPublicIp",
        skip_serializing_if = "Option::is_none"
    )]
    pub export_subnet_routes_with_public_ip: Option<bool>,
    /// Whether to import the custom routes from peer network. The default value is false.
    #[serde(rename = "importCustomRoutes", skip_serializing_if = "Option::is_none")]
    pub import_custom_routes: Option<bool>,
    /// Whether subnet routes with public IP range are imported. The default value is false. IPv4 special-use ranges are always imported from peers and are not controlled by this field.
    #[serde(
        rename = "importSubnetRoutesWithPublicIp",
        skip_serializing_if = "Option::is_none"
    )]
    pub import_subnet_routes_with_public_ip: Option<bool>,
    /// Name of this peering. Provided by the client when the peering is created. The name must comply with RFC1035. Specifically, the name must be 1-63 characters long and match regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`. The first character must be a lowercase letter, and all the following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// The URL of the peer network. It can be either full URL or partial URL. The peer network may belong to a different project. If the partial URL does not contain project, it is assumed that the peer network is in the same project as the current network.
    #[serde(rename = "network", skip_serializing_if = "Option::is_none")]
    pub network: Option<String>,
    /// Maximum Transmission Unit in bytes.
    #[serde(rename = "peerMtu", skip_serializing_if = "Option::is_none")]
    pub peer_mtu: Option<i32>,
    /// Which IP version(s) of traffic and routes are allowed to be imported or exported between peer networks. The default value is IPV4_ONLY.
    #[serde(rename = "stackType", skip_serializing_if = "Option::is_none")]
    pub stack_type: Option<StackType>,
    /// [Output Only] State for the peering, either `ACTIVE` or `INACTIVE`. The peering is `ACTIVE` when there's a matching configuration in the peer network.
    #[serde(rename = "state", skip_serializing_if = "Option::is_none")]
    pub state: Option<State>,
    /// [Output Only] Details about the current state of the peering.
    #[serde(rename = "stateDetails", skip_serializing_if = "Option::is_none")]
    pub state_details: Option<String>,
}

impl NetworkPeering {
    /// A network peering attached to a network resource. The message includes the peering name, peer network, peering state, and a flag indicating whether Google Compute Engine should automatically create routes for the peering.
    pub fn new() -> NetworkPeering {
        NetworkPeering {
            auto_create_routes: None,
            exchange_subnet_routes: None,
            export_custom_routes: None,
            export_subnet_routes_with_public_ip: None,
            import_custom_routes: None,
            import_subnet_routes_with_public_ip: None,
            name: None,
            network: None,
            peer_mtu: None,
            stack_type: None,
            state: None,
            state_details: None,
        }
    }
}

/// Which IP version(s) of traffic and routes are allowed to be imported or exported between peer networks. The default value is IPV4_ONLY.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum StackType {
    #[serde(rename = "IPV4_IPV6")]
    Ipv6,
    #[serde(rename = "IPV4_ONLY")]
    Only,
}

impl Default for StackType {
    fn default() -> StackType {
        Self::Ipv6
    }
}
/// [Output Only] State for the peering, either `ACTIVE` or `INACTIVE`. The peering is `ACTIVE` when there's a matching configuration in the peer network.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum State {
    #[serde(rename = "ACTIVE")]
    Active,
    #[serde(rename = "INACTIVE")]
    Inactive,
}

impl Default for State {
    fn default() -> State {
        Self::Active
    }
}
