1use serde::{Deserialize, Serialize};
2
3use super::common::Id;
4
5use crate::util::serde_bool_like;
6
7#[derive(Serialize, Deserialize, Debug, Clone)]
8pub struct Script(pub Vec<Vec<Block>>);
9
10#[derive(Serialize, Deserialize, Debug, Clone)]
11#[serde(rename_all = "camelCase")]
12pub struct Block {
13 pub id: Id,
14 pub x: f32,
15 pub y: f32,
16 #[serde(rename = "type")]
17 pub block_type: String,
18 pub params: Vec<Param>,
19 pub statements: Script,
20 pub movable: Option<bool>,
21 #[serde(deserialize_with = "serde_bool_like::deserialize")]
22 pub deletable: bool,
23 pub emphasized: bool,
24 pub read_only: Option<bool>,
25 pub copyable: bool,
26 pub extensions: Vec<String>, }
28
29#[derive(Serialize, Deserialize, Debug, Clone)]
30#[serde(untagged)]
31pub enum Param {
32 Block(Block),
33 Number(f32),
34 String(String),
35 Bool(bool),
36 Null,
37}