pub mod catalog;
pub mod content_block;
pub mod custom_attribute;
pub mod email_template;
pub use catalog::{Catalog, CatalogField, CatalogFieldType};
pub use content_block::{ContentBlock, ContentBlockState};
pub use custom_attribute::{CustomAttribute, CustomAttributeRegistry, CustomAttributeType};
pub use email_template::EmailTemplate;
#[derive(Debug, Clone, PartialEq)]
pub enum Resource {
CatalogSchema(Catalog),
ContentBlock(ContentBlock),
EmailTemplate(EmailTemplate),
CustomAttributeRegistry(CustomAttributeRegistry),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, clap::ValueEnum)]
#[clap(rename_all = "snake_case")]
pub enum ResourceKind {
CatalogSchema,
ContentBlock,
EmailTemplate,
CustomAttribute,
}
impl ResourceKind {
pub fn as_str(&self) -> &'static str {
match self {
Self::CatalogSchema => "catalog_schema",
Self::ContentBlock => "content_block",
Self::EmailTemplate => "email_template",
Self::CustomAttribute => "custom_attribute",
}
}
pub fn all() -> &'static [Self] {
&[
Self::CatalogSchema,
Self::ContentBlock,
Self::EmailTemplate,
Self::CustomAttribute,
]
}
}
impl Resource {
pub fn kind(&self) -> ResourceKind {
match self {
Self::CatalogSchema(_) => ResourceKind::CatalogSchema,
Self::ContentBlock(_) => ResourceKind::ContentBlock,
Self::EmailTemplate(_) => ResourceKind::EmailTemplate,
Self::CustomAttributeRegistry(_) => ResourceKind::CustomAttribute,
}
}
}