use super::SweetZome;
use hdk::prelude::*;
use holo_hash::DnaHash;
use holochain_conductor_api::conductor::ConductorConfig;
use holochain_sqlite::db::{DbKindAuthored, DbKindDht};
use holochain_types::db::DbWrite;
use std::sync::Arc;
#[derive(Clone, Debug)]
pub struct SweetCell {
pub(super) cell_id: CellId,
pub(super) cell_authored_db: DbWrite<DbKindAuthored>,
pub(super) cell_dht_db: DbWrite<DbKindDht>,
pub(super) conductor_config: Arc<ConductorConfig>,
}
impl SweetCell {
pub fn cell_id(&self) -> &CellId {
&self.cell_id
}
pub fn authored_db(&self) -> &DbWrite<DbKindAuthored> {
&self.cell_authored_db
}
pub fn dht_db(&self) -> &DbWrite<DbKindDht> {
&self.cell_dht_db
}
pub fn agent_pubkey(&self) -> &AgentPubKey {
self.cell_id.agent_pubkey()
}
pub fn dna_hash(&self) -> &DnaHash {
self.cell_id.dna_hash()
}
pub fn zome<Z: Into<ZomeName>>(&self, zome_name: Z) -> SweetZome {
SweetZome::new(self.cell_id.clone(), zome_name.into())
}
pub fn conductor_config(&self) -> Arc<ConductorConfig> {
self.conductor_config.clone()
}
}