use super::Hnt;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct Validator {
pub address: String,
pub owner: String,
pub stake: Hnt,
pub last_heartbeat: u64,
pub version_heartbeat: u64,
pub stake_status: String,
pub penalty: f64,
pub penalties: Vec<Penalty>,
pub block_added: u64,
pub block: u64,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct ValidatorStats {
pub active: Option<u64>,
pub staked: StakeStats,
pub unstaked: StakeStats,
pub cooldown: StakeStats,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Reward {
pub account: String,
#[serde(deserialize_with = "Hnt::deserialize")]
pub amount: Hnt,
pub block: i64,
pub gateway: String,
pub hash: String,
pub timestamp: DateTime<Utc>,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct StakeStats {
pub amount: f64,
pub count: u64,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
#[serde(rename_all = "snake_case")]
pub enum PenaltyType {
Performance,
Tenure,
Dkg,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct Penalty {
#[serde(rename = "type")]
pub kind: PenaltyType,
pub height: u64,
pub amount: f64,
}