mindcontrol_types 0.21.0

Mind Control types
Documentation
use litty::literal;
use serde::{Deserialize, Serialize};

/// Collection base type.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CollectionBase {
    /// Schema version.
    pub v: CollectionBaseV1,
    /// Unix timestamp in milliseconds when the collection version was updated.
    pub time: i64,
    /// Major collection version number.
    pub major: u16,
    /// Minor collection version number.
    pub minor: u16,
    /// Signifies if the collection version is a draft.
    pub draft: bool,
}

#[literal(1)]
pub struct CollectionBaseV1;

/// Collection version.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CollectionV1 {
    /// Schema version.
    pub v: CollectionBaseV1,
    /// Unix timestamp in milliseconds when the collection version was updated.
    pub time: i64,
    /// Major collection version number.
    pub major: u16,
    /// Minor collection version number.
    pub minor: u16,
    /// Signifies if the collection version is a draft.
    pub draft: bool,
    /// Collection payload JSON.
    pub payload: String,
    /// Collection settings JSON.
    pub settings: Option<String>,
}

/// Parsed collection version. Unlike regular collection, the payload property is a parsed JSON object.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CollectionParsedV1 {
    /// Schema version.
    pub v: CollectionBaseV1,
    /// Unix timestamp in milliseconds when the collection version was updated.
    pub time: i64,
    /// Major collection version number.
    pub major: u16,
    /// Minor collection version number.
    pub minor: u16,
    /// Signifies if the collection version is a draft.
    pub draft: bool,
    /// Collection payload.
    pub payload: super::payload::PayloadV1,
    /// Collection settings.
    pub settings: CollectionSettings,
}

/// Collection settings object. Unused for now.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CollectionSettings {
    CollectionSettingsObj(CollectionSettingsObj),
    Null(()),
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CollectionSettingsObj {}