rojo 0.4.11

A tool to create robust Roblox projects
use std::collections::HashMap;

/// Represents data about a Roblox instance
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct RbxInstance {
    pub name: String,
    pub class_name: String,

    #[serde(default = "Vec::new")]
    pub children: Vec<RbxInstance>,

    #[serde(default = "HashMap::new")]
    pub properties: HashMap<String, RbxValue>,

    /// The route that this instance was generated from, if there was one.
    pub route: Option<Vec<String>>,
}

/// Any kind value that can be used by Roblox
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase", tag = "Type")]
pub enum RbxValue {
    #[serde(rename_all = "PascalCase")]
    String {
        value: String,
    },
    #[serde(rename_all = "PascalCase")]
    Bool {
        value: bool,
    },
    #[serde(rename_all = "PascalCase")]
    Number {
        value: f64,
    },

    // TODO: Compound types like Vector3
}