use serde::Deserialize; use crate::marble_engine::board::Board; #[derive(Debug, Deserialize)] pub struct Level { id: String, name: String, description: String, init_board: Option, inputs: Vec, outputs: Vec, } impl Level { pub fn new_sandbox() -> Self { Self { id: "sandbox".into(), name: "Sandbox".into(), description: String::new(), init_board: None, inputs: Vec::new(), outputs: Vec::new(), } } pub fn id(&self) -> &str { &self.id } pub fn name(&self) -> &str { &self.name } pub fn description(&self) -> &str { &self.description } pub fn init_board(&self) -> Option { self.init_board.as_deref().map(Board::parse) } pub fn inputs(&self) -> &[u8] { &self.inputs } pub fn outputs(&self) -> &[u8] { &self.outputs } }