/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.
 *
 * The version of the OpenAPI document: 1.0.0-rc.3
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ScoredPeerResponse {
    #[serde(rename = "available_chunks")]
    pub available_chunks: i32,
    #[serde(rename = "bandwidth_estimate_bps", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub bandwidth_estimate_bps: Option<Option<i64>>,
    #[serde(rename = "endpoint_url")]
    pub endpoint_url: String,
    #[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 = "peer_id")]
    pub peer_id: uuid::Uuid,
    #[serde(rename = "score")]
    pub score: f64,
}

impl ScoredPeerResponse {
    pub fn new(available_chunks: i32, endpoint_url: String, peer_id: uuid::Uuid, score: f64) -> ScoredPeerResponse {
        ScoredPeerResponse {
            available_chunks,
            bandwidth_estimate_bps: None,
            endpoint_url,
            latency_ms: None,
            peer_id,
            score,
        }
    }
}

