use std::collections::BTreeMap;
use super::Span;
use super::node::UnknownProperty;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum AssetKind {
Image,
Svg,
Font,
Unknown(String),
}
impl AssetKind {
pub fn from_kind_str(s: &str) -> Self {
match s {
"image" => Self::Image,
"svg" => Self::Svg,
"font" => Self::Font,
other => Self::Unknown(other.to_owned()),
}
}
pub fn kind_str(&self) -> &str {
match self {
Self::Image => "image",
Self::Svg => "svg",
Self::Font => "font",
Self::Unknown(s) => s.as_str(),
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct AssetDecl {
pub id: String,
pub kind: AssetKind,
pub src: String,
pub sha256: Option<String>,
pub ai_prompt: Option<String>,
pub ai_model: Option<String>,
pub ai_provider: Option<String>,
pub ai_seed: Option<i64>,
pub ai_generation_date: Option<String>,
pub ai_license: Option<String>,
pub ai_source_rights: Option<String>,
pub ai_safety_status: Option<String>,
pub ai_reuse_policy: Option<String>,
pub source_span: Option<Span>,
pub unknown_props: BTreeMap<String, UnknownProperty>,
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct AssetBlock {
pub assets: Vec<AssetDecl>,
pub source_span: Option<Span>,
}