use serde::{Deserialize, Serialize};
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum IcManagementMethodRecord {
CanisterStatus,
ListCanisterSnapshots,
LoadCanisterSnapshot,
StartCanister,
StopCanister,
TakeCanisterSnapshot,
}
impl IcManagementMethodRecord {
#[must_use]
pub const fn name(self) -> &'static str {
match self {
Self::CanisterStatus => "canister_status",
Self::ListCanisterSnapshots => "list_canister_snapshots",
Self::LoadCanisterSnapshot => "load_canister_snapshot",
Self::StartCanister => "start_canister",
Self::StopCanister => "stop_canister",
Self::TakeCanisterSnapshot => "take_canister_snapshot",
}
}
#[must_use]
pub const fn effect(self) -> IcRequestEffect {
match self {
Self::CanisterStatus | Self::ListCanisterSnapshots => IcRequestEffect::Observation,
Self::LoadCanisterSnapshot
| Self::StartCanister
| Self::StopCanister
| Self::TakeCanisterSnapshot => IcRequestEffect::Mutation,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum IcRequestEffect {
Observation,
Mutation,
}