use crate::{
cdk::types::Principal, dto::canister::CanisterInfo, dto::topology::SubnetRegistryEntry,
};
pub struct SubnetRegistryResponseMapper;
impl SubnetRegistryResponseMapper {
#[must_use]
pub fn record_to_response(
pid: Principal,
record: crate::storage::canister::CanisterRecord,
) -> SubnetRegistryEntry {
let record_view = CanisterInfo {
pid,
role: record.role.clone(),
parent_pid: record.parent_pid,
module_hash: record.module_hash,
created_at: record.created_at,
};
SubnetRegistryEntry {
pid,
role: record_view.role.clone(),
record: record_view,
}
}
}