use tollgate_core::{AccountStatus, CapacityClass, CostUnits, Generation};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "wire", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "wire", serde(tag = "kind", rename_all = "snake_case"))]
pub enum AdminState {
Absent,
AccountCreated {
initial_balance: CostUnits,
status: AccountStatus,
capacity_class: CapacityClass,
},
Funding {
topup: CostUnits,
deposited: CostUnits,
},
Status {
status: AccountStatus,
},
CapacityClass {
capacity_class: CapacityClass,
},
Snapshot {
generation: Generation,
revoked: bool,
},
Credential {
account_id: tollgate_core::AccountId,
key_id: tollgate_core::KeyId,
revoked: bool,
},
Budget {
schedule: Option<tollgate_core::BudgetSchedule>,
},
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AdminReceipt<T> {
pub outcome: T,
pub before: AdminState,
pub after: AdminState,
}
impl<T> AdminReceipt<T> {
pub fn new(outcome: T, before: AdminState, after: AdminState) -> Self {
Self {
outcome,
before,
after,
}
}
}