#![allow(dead_code)]
#![allow(non_snake_case)]

use serde::{Deserialize, Serialize};
use std::time::Duration;

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct ConfigRelayDetail {
    relayIdleTime: u64,
    downloadIdleTime: u64,
    relayProtectTime: u64,
    downloadProtectTime: u64,
}

#[allow(non_snake_case)]
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct ConfigRelay {
    pub relayGroup: ConfigRelayDetail,
    pub relayGroupManager: ConfigRelayDetail,
}

impl ConfigRelayDetail {
    pub fn relayIdleTime(&self) -> Duration {
        Duration::from_millis(self.relayIdleTime)
    }
    pub fn downloadIdleTime(&self) -> Duration {
        Duration::from_millis(self.downloadIdleTime)
    }
    pub fn relayProtectTime(&self) -> Duration {
        Duration::from_millis(self.relayProtectTime)
    }
    pub fn downloadProtectTime(&self) -> Duration {
        Duration::from_millis(self.downloadProtectTime)
    }
}
