/*
 * 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 EdgeNode {
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "region")]
    pub region: String,
    #[serde(rename = "url")]
    pub url: String,
    #[serde(rename = "status")]
    pub status: Status,
    #[serde(rename = "cache_size_mb")]
    pub cache_size_mb: i32,
    #[serde(rename = "capacity_mb")]
    pub capacity_mb: i32,
    #[serde(rename = "last_heartbeat", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub last_heartbeat: Option<Option<String>>,
    /// Repository keys assigned to this edge node
    #[serde(rename = "repositories")]
    pub repositories: Vec<String>,
    #[serde(rename = "created_at")]
    pub created_at: String,
}

impl EdgeNode {
    pub fn new(id: uuid::Uuid, name: String, region: String, url: String, status: Status, cache_size_mb: i32, capacity_mb: i32, repositories: Vec<String>, created_at: String) -> EdgeNode {
        EdgeNode {
            id,
            name,
            region,
            url,
            status,
            cache_size_mb,
            capacity_mb,
            last_heartbeat: None,
            repositories,
            created_at,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "healthy")]
    Healthy,
    #[serde(rename = "degraded")]
    Degraded,
    #[serde(rename = "offline")]
    Offline,
}

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

