/*
 * Artifact Keeper API
 *
 * REST API for Artifact Keeper, an open-source universal artifact registry. Covers user management, repositories, artifacts, search, security scanning, SBOM, dependency tracking, SSO, analytics, monitoring, telemetry, lifecycle policies, plugins, edge nodes, migration, and administration. Format-specific protocol endpoints (npm, PyPI, Maven, Docker/OCI, etc.) are not included; those follow their respective upstream specifications.
 *
 * The version of the OpenAPI document: 1.0.0-a2
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PeerConnection {
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "node_id")]
    pub node_id: uuid::Uuid,
    #[serde(rename = "peer_node_id")]
    pub peer_node_id: uuid::Uuid,
    #[serde(rename = "latency_ms", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub latency_ms: Option<Option<i32>>,
    #[serde(rename = "bandwidth_mbps", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub bandwidth_mbps: Option<Option<f64>>,
    #[serde(rename = "status")]
    pub status: Status,
}

impl PeerConnection {
    pub fn new(id: uuid::Uuid, node_id: uuid::Uuid, peer_node_id: uuid::Uuid, status: Status) -> PeerConnection {
        PeerConnection {
            id,
            node_id,
            peer_node_id,
            latency_ms: None,
            bandwidth_mbps: None,
            status,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "connected")]
    Connected,
    #[serde(rename = "disconnected")]
    Disconnected,
}

impl Default for Status {
    fn default() -> Status {
        Self::Connected
    }
}

