use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use ts_rs::TS;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema, TS)]
#[serde(rename_all = "lowercase")]
pub enum StateSchemaType {
Array,
Object,
String,
Number,
Boolean,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, TS)]
pub struct StateSchemaProperty {
pub r#type: StateSchemaType,
#[serde(default)]
#[ts(optional=nullable)]
pub description: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, TS)]
pub struct StateSchema {
pub name: String,
pub r#type: StateSchemaType,
#[serde(default)]
#[ts(optional=nullable)]
pub items: Option<Box<StateSchemaItems>>,
#[serde(default)]
#[ts(optional=nullable)]
pub description: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, TS)]
pub struct StateSchemaItems {
pub r#type: StateSchemaType,
#[serde(default)]
#[ts(optional=nullable)]
pub properties: Option<HashMap<String, StateSchemaProperty>>,
}