use crate::fleet_ensure::{
CompletedCoordinatorMembershipView, CompletedEstateCustodyView, CompletedLedgerBalancesView,
model::DesiredCanisterKind,
};
use candid::Principal;
use canic_core::ids::{ComponentInstanceId, FleetSubnetCanisterPoolConfig};
use std::collections::BTreeMap;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CompletedRootMembershipView {
pub(in crate::fleet_ensure) root: Principal,
pub(in crate::fleet_ensure) config: FleetSubnetCanisterPoolConfig,
pub(in crate::fleet_ensure) completed_handoffs: u64,
pub(in crate::fleet_ensure) assets: BTreeMap<Principal, CompletedPoolAssetView>,
}
impl CompletedRootMembershipView {
#[must_use]
pub const fn root(&self) -> Principal {
self.root
}
#[must_use]
pub const fn config(&self) -> &FleetSubnetCanisterPoolConfig {
&self.config
}
#[must_use]
pub const fn completed_handoffs(&self) -> u64 {
self.completed_handoffs
}
#[must_use]
pub const fn assets(&self) -> &BTreeMap<Principal, CompletedPoolAssetView> {
&self.assets
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CompletedPoolAssetView {
pub(in crate::fleet_ensure) kind: DesiredCanisterKind,
pub(in crate::fleet_ensure) allocation: Option<CompletedWorkloadAllocationView>,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CompletedWorkloadAllocationView {
pub component: ComponentInstanceId,
pub operation_id: [u8; 32],
}
impl CompletedPoolAssetView {
#[must_use]
pub const fn kind(&self) -> DesiredCanisterKind {
self.kind
}
#[must_use]
pub const fn allocation(&self) -> Option<&CompletedWorkloadAllocationView> {
self.allocation.as_ref()
}
}
#[derive(Debug)]
pub struct CompletedEstateMembershipView {
pub(in crate::fleet_ensure) custody: CompletedEstateCustodyView,
pub(in crate::fleet_ensure) coordinator: CompletedCoordinatorMembershipView,
pub(in crate::fleet_ensure) roots: BTreeMap<String, CompletedRootMembershipView>,
pub(in crate::fleet_ensure) ledger: CompletedLedgerBalancesView,
}
impl CompletedEstateMembershipView {
#[must_use]
pub const fn coordinator(&self) -> &CompletedCoordinatorMembershipView {
&self.coordinator
}
#[must_use]
pub const fn custody(&self) -> &CompletedEstateCustodyView {
&self.custody
}
#[must_use]
pub const fn roots(&self) -> &BTreeMap<String, CompletedRootMembershipView> {
&self.roots
}
#[must_use]
pub const fn ledger(&self) -> &CompletedLedgerBalancesView {
&self.ledger
}
}