use wot_network::Certification as WotCertification;
#[derive(Debug, Clone)]
pub(crate) struct Certification {
pub inner: WotCertification,
pub allowed_amount: u8,
pub used_amount: u8,
}
impl Certification {
pub fn new(wot_cert: WotCertification) -> Self {
Self {
inner: wot_cert,
allowed_amount: 120,
used_amount: 0,
}
}
pub fn available_amount(&self) -> u8 {
self.allowed_amount.saturating_sub(self.used_amount)
}
}
impl PartialEq for Certification {
fn eq(&self, other: &Self) -> bool {
self.inner == other.inner
}
}
impl Eq for Certification {}
impl std::hash::Hash for Certification {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.inner.hash(state);
}
}