use crate::model::RecipeEntry;
use camino::Utf8PathBuf;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize)]
pub struct RecipeTree {
pub name: String,
pub path: Utf8PathBuf,
pub recipe: Option<RecipeEntry>,
pub children: HashMap<String, RecipeTree>,
}
impl RecipeTree {
pub(crate) fn new(name: String, path: Utf8PathBuf) -> Self {
RecipeTree {
name,
path,
recipe: None,
children: HashMap::new(),
}
}
pub(crate) fn new_with_recipe(name: String, path: Utf8PathBuf, recipe: RecipeEntry) -> Self {
RecipeTree {
name,
path,
recipe: Some(recipe),
children: HashMap::new(),
}
}
}