use alloc::vec::Vec;
use miden_protocol::Word;
use miden_protocol::account::AccountComponent;
mod allow_all;
mod owner_only;
pub use allow_all::MintAllowAll;
pub use owner_only::MintOwnerOnly;
#[derive(Debug, Clone, Copy, Default)]
pub enum MintPolicyConfig {
AllowAll,
#[default]
OwnerOnly,
Custom(Word),
}
impl MintPolicyConfig {
pub fn root(self) -> Word {
match self {
Self::AllowAll => MintAllowAll::root().as_word(),
Self::OwnerOnly => MintOwnerOnly::root().as_word(),
Self::Custom(root) => root,
}
}
pub(crate) fn into_components(self) -> Vec<AccountComponent> {
match self {
Self::AllowAll => vec![MintAllowAll.into()],
Self::OwnerOnly => vec![MintOwnerOnly.into()],
Self::Custom(_) => Vec::new(),
}
}
}