use yog_ids::Format;
use yog_ids::sep::PATH;
use crate::content::file::generated;
const BOOKS_DIR: &str = "books";
const ENTITIES_DIR: &str = yog_ids::word::ENTITIES;
const FONTS_DIR: &str = "fonts";
const BODY_DIR: &str = "body";
const MODELS_DIR: &str = "models";
const ANIMS_DIR: &str = "anims";
pub(in crate::content) struct BookFile {
pub(in crate::content) id: String,
pub(in crate::content) data: Vec<u8>,
}
pub(in crate::content) struct EntityFile {
pub(in crate::content) id: String,
pub(in crate::content) file: String,
pub(in crate::content) model: Option<String>,
pub(in crate::content) animations: Option<String>,
pub(in crate::content) data: Vec<u8>,
}
impl EntityFile {
pub(in crate::content) fn path(&self) -> String {
generated(ENTITIES_DIR, &self.id, Format::Data)
}
}
pub(in crate::content) struct BodyFile {
pub(in crate::content) model: bool,
pub(in crate::content) id: String,
pub(in crate::content) data: Vec<u8>,
}
pub(in crate::content) struct FontFile {
pub(in crate::content) id: String,
pub(in crate::content) data: Vec<u8>,
}
impl FontFile {
pub(in crate::content) fn path(&self) -> String {
generated(FONTS_DIR, &self.id, Format::Font)
}
}
impl BodyFile {
pub(in crate::content) fn path(&self) -> String {
let dir = if self.model { MODELS_DIR } else { ANIMS_DIR };
generated(&[BODY_DIR, dir].join(PATH), &self.id, Format::Data)
}
}
impl BookFile {
pub(in crate::content) fn path(&self) -> String {
generated(BOOKS_DIR, &self.id, Format::Data)
}
}