use std::collections::HashMap;
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)]
#[repr(i32)]
pub enum VERTICAL_ALIGN {
TOP = 10,
MIDDLE = 11,
BOTTOM = 12,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)]
#[repr(i32)]
pub enum TEXT_ALIGN {
LEFT = 10,
CENTER = 11,
RIGHT = 12,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)]
#[repr(i32)]
pub enum LINE_SPACING_TYPE {
AT_LEAST = 10,
EXACTLY = 11,
MULTIPLE = 12,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)]
#[repr(i32)]
pub enum STROKE_PLACEMENT {
INSIDE = 10,
CENTER = 11,
OUTSIDE = 12,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)]
#[repr(i32)]
pub enum STROKE_PREFERENCE {
SOLID = 10,
DASHED = 11,
DOTTED = 12,
CUSTOM = 13,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)]
#[repr(i32)]
pub enum STROKE_SIDE_PREFERENCE {
TOP = 10,
BOTTOM = 11,
LEFT = 12,
RIGHT = 13,
CUSTOM = 14,
ALL = 15,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)]
#[repr(i32)]
pub enum STROKE_CAP {
BUTT = 10,
ROUND = 11,
SQUARE = 12,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)]
#[repr(i32)]
pub enum STROKE_JOIN {
MITER = 10,
ROUND = 11,
BEVEL = 12,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)]
#[repr(i32)]
pub enum LINE_HEAD {
ARROW = 10,
BAR = 11,
CIRCLE = 12,
CIRCLE_OUTLINED = 13,
TRIANGLE = 14,
TRIANGLE_OUTLINED = 15,
DIAMOND = 16,
DIAMOND_OUTLINED = 17,
CROSS = 18,
OPEN_ARROW = 19,
REVERSED_ARROW = 20,
REVERSED_TRIANGLE = 21,
REVERSED_TRIANGLE_OUTLINED = 22,
CONE = 23,
HALF_CONE = 24,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)]
#[repr(i32)]
pub enum BEZIER_MIRRORING {
NONE = 10,
ANGLE = 11,
ANGLE_LENGTH = 12,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)]
#[repr(i32)]
pub enum BLENDING {
MULTIPLY = 11,
SCREEN = 12,
OVERLAY = 13,
DARKEN = 14,
LIGHTEN = 15,
DIFFERENCE = 16,
EXCLUSION = 17,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)]
#[repr(i32)]
pub enum ELEMENT_CONTENT_PREFERENCE {
SOLID = 12,
FILL = 14,
FIT = 15,
TILE = 16,
STRETCH = 17,
HATCH = 18,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)]
#[repr(i32)]
pub enum HATCH_STYLE {
NORMAL = 10,
OUTER = 11,
IGNORE = 12,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)]
#[repr(i32)]
pub enum IMAGE_STATUS {
PENDING = 10,
SAVED = 11,
ERROR = 12,
}
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)]
#[repr(i32)]
pub enum BOOLEAN_OPERATION {
UNION = 10,
SUBTRACT = 11,
INTERSECT = 12,
EXCLUDE = 13,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DictionaryEntry {
pub key: String,
pub value: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct StringValueEntry {
pub key: String,
pub value: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct GeometricPoint {
pub x: f64,
pub y: f64,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucPoint {
pub x: f64,
pub y: f64,
pub mirroring: Option<BEZIER_MIRRORING>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Margins {
pub top: f64,
pub right: f64,
pub bottom: f64,
pub left: f64,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Viewer3DClipPlane {
pub enabled: bool,
pub value: f64,
pub normal: Option<[f64; 3]>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Viewer3DMaterial {
pub metalness: f32,
pub roughness: f32,
pub default_opacity: f32,
pub edge_color: u32,
pub ambient_intensity: f32,
pub direct_intensity: f32,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Viewer3DZebra {
pub active: bool,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub stripe_count: i32,
pub stripe_direction: f64,
pub color_scheme: String,
pub opacity: f32,
pub mapping_mode: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Viewer3DCamera {
pub control: String,
pub ortho: bool,
pub up: String,
pub position: [f64; 3],
pub quaternion: [f64; 4],
pub target: [f64; 3],
pub zoom: f64,
pub pan_speed: f32,
pub rotate_speed: f32,
pub zoom_speed: f32,
pub holroyd: bool,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Viewer3DGridPlanes {
pub xy: bool,
pub xz: bool,
pub yz: bool,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(tag = "type", content = "value", rename_all = "camelCase")]
pub enum Viewer3DGrid {
Uniform(bool),
PerPlane(Viewer3DGridPlanes),
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Viewer3DDisplay {
pub wireframe: bool,
pub transparent: bool,
pub black_edges: bool,
pub grid: Viewer3DGrid,
pub axes_visible: bool,
pub axes_at_origin: bool,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Viewer3DClipping {
pub x: Viewer3DClipPlane,
pub y: Viewer3DClipPlane,
pub z: Viewer3DClipPlane,
pub intersection: bool,
pub show_planes: bool,
pub object_color_caps: bool,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Viewer3DExplode {
pub active: bool,
pub value: f64,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Viewer3DState {
pub camera: Viewer3DCamera,
pub display: Viewer3DDisplay,
pub material: Viewer3DMaterial,
pub clipping: Viewer3DClipping,
pub explode: Viewer3DExplode,
pub zebra: Viewer3DZebra,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TilingProperties {
pub size_in_percent: f32,
pub angle: f64,
pub spacing: Option<f64>,
pub offset_x: Option<f64>,
pub offset_y: Option<f64>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct HatchPatternLine {
pub angle: f64,
pub origin: DucPoint,
pub offset: Vec<f64>,
pub dash_pattern: Vec<f64>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CustomHatchPattern {
pub name: String,
pub description: Option<String>,
pub lines: Vec<HatchPatternLine>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucHatchStyle {
pub hatch_style: HATCH_STYLE,
pub pattern_name: String,
pub pattern_scale: f32,
pub pattern_angle: f64,
pub pattern_origin: DucPoint,
pub pattern_double: bool,
pub custom_pattern: Option<CustomHatchPattern>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucImageFilter {
pub brightness: f32,
pub contrast: f32,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ElementContentBase {
pub preference: Option<ELEMENT_CONTENT_PREFERENCE>,
pub src: String,
pub visible: bool,
pub opacity: f64,
pub tiling: Option<TilingProperties>,
pub hatch: Option<DucHatchStyle>,
pub image_filter: Option<DucImageFilter>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct StrokeStyle {
pub preference: Option<STROKE_PREFERENCE>,
pub cap: Option<STROKE_CAP>,
pub join: Option<STROKE_JOIN>,
pub dash: Option<Vec<f64>>,
pub dash_line_override: Option<String>,
pub dash_cap: Option<STROKE_CAP>,
pub miter_limit: Option<f64>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct StrokeSides {
pub preference: Option<STROKE_SIDE_PREFERENCE>,
pub values: Option<Vec<f64>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ElementStroke {
pub content: ElementContentBase,
pub width: f64,
pub style: StrokeStyle,
pub placement: Option<STROKE_PLACEMENT>,
pub stroke_sides: Option<StrokeSides>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ElementBackground {
pub content: ElementContentBase,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucElementStylesBase {
pub roundness: f64,
pub blending: Option<BLENDING>,
pub background: Vec<ElementBackground>,
pub stroke: Vec<ElementStroke>,
pub opacity: f64,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct BoundElement {
pub id: String,
#[serde(rename = "type")]
pub element_type: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucElementBase {
pub id: String,
#[serde(flatten)]
pub styles: DucElementStylesBase,
pub x: f64,
pub y: f64,
pub width: f64,
pub height: f64,
pub angle: f64,
pub scope: String,
pub label: String,
pub description: Option<String>,
pub is_visible: bool,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub seed: i32,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub version: i32,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub version_nonce: i32,
pub updated: i64,
pub index: Option<String>,
pub is_plot: bool,
pub is_deleted: bool,
pub group_ids: Vec<String>,
pub block_ids: Vec<String>,
pub region_ids: Vec<String>,
pub instance_id: Option<String>,
pub layer_id: Option<String>,
pub frame_id: Option<String>,
pub bound_elements: Option<Vec<BoundElement>>,
pub z_index: f32,
pub link: Option<String>,
pub locked: bool,
pub custom_data: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucHead {
#[serde(rename = "type")]
pub head_type: Option<LINE_HEAD>,
pub block_id: Option<String>,
pub size: f64,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PointBindingPoint {
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub index: i32,
pub offset: f64,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucPointBinding {
pub element_id: String,
pub focus: f32,
pub gap: f64,
pub fixed_point: Option<GeometricPoint>,
pub point: Option<PointBindingPoint>,
pub head: Option<DucHead>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucLineReference {
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub index: i32,
pub handle: Option<GeometricPoint>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucLine {
pub start: DucLineReference,
pub end: DucLineReference,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucPath {
#[serde(deserialize_with = "crate::serde_utils::trunc_vec_i32")]
pub line_indices: Vec<i32>,
pub background: Option<ElementBackground>,
pub stroke: Option<ElementStroke>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucLinearElementBase {
#[serde(flatten)]
pub base: DucElementBase,
pub points: Vec<DucPoint>,
pub lines: Vec<DucLine>,
pub path_overrides: Vec<DucPath>,
pub last_committed_point: Option<DucPoint>,
pub start_binding: Option<DucPointBinding>,
pub end_binding: Option<DucPointBinding>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucStackLikeStyles {
pub opacity: f64,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucStackBase {
pub label: String,
pub description: Option<String>,
pub is_collapsed: bool,
pub is_plot: bool,
pub is_visible: bool,
pub locked: bool,
#[serde(flatten)]
pub styles: DucStackLikeStyles,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucStackElementBase {
#[serde(flatten)]
pub base: DucElementBase,
pub stack_base: DucStackBase,
pub clip: bool,
pub label_visible: bool,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LineSpacing {
pub value: f64,
#[serde(rename = "type")]
pub line_type: Option<LINE_SPACING_TYPE>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucTextStyle {
pub is_ltr: bool,
pub font_family: String,
pub big_font_family: String,
pub text_align: TEXT_ALIGN,
pub vertical_align: VERTICAL_ALIGN,
pub line_height: f32,
pub line_spacing: LineSpacing,
pub oblique_angle: f64,
pub font_size: f64,
pub width_factor: f32,
pub is_upside_down: bool,
pub is_backwards: bool,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucTableStyle {}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucDocStyle {}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucPlotStyle {}
#[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum ElementType {
Rectangle,
Ellipse,
Polygon,
Table,
Text,
Line,
Arrow,
FreeDraw,
Image,
Frame,
Plot,
Doc,
Model,
Embeddable,
Pdf,
}
impl ElementType {
pub fn as_str(&self) -> &'static str {
match self {
ElementType::Rectangle => "rectangle",
ElementType::Ellipse => "ellipse",
ElementType::Polygon => "polygon",
ElementType::Table => "table",
ElementType::Text => "text",
ElementType::Line => "line",
ElementType::Arrow => "arrow",
ElementType::FreeDraw => "freedraw",
ElementType::Image => "image",
ElementType::Frame => "frame",
ElementType::Plot => "plot",
ElementType::Doc => "doc",
ElementType::Model => "model",
ElementType::Embeddable => "embeddable",
ElementType::Pdf => "pdf",
}
}
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DucElementVariant {
Rectangle(DucRectangleElement),
Ellipse(DucEllipseElement),
Polygon(DucPolygonElement),
Linear(DucLinearElement),
Arrow(DucArrowElement),
Text(DucTextElement),
Image(DucImageElement),
Frame(DucFrameElement),
FreeDraw(DucFreeDrawElement),
Table(DucTableElement),
Plot(DucPlotElement),
Doc(DucDocElement),
Model(DucModelElement),
Embeddable(DucEmbeddableElement),
Pdf(DucPdfElement),
}
impl DucElementVariant {
pub fn get_base(&self) -> &DucElementBase {
match self {
DucElementVariant::Rectangle(elem) => &elem.base,
DucElementVariant::Ellipse(elem) => &elem.base,
DucElementVariant::Polygon(elem) => &elem.base,
DucElementVariant::Linear(elem) => &elem.linear_base.base,
DucElementVariant::Arrow(elem) => &elem.linear_base.base,
DucElementVariant::Text(elem) => &elem.base,
DucElementVariant::Image(elem) => &elem.base,
DucElementVariant::Frame(elem) => &elem.stack_element_base.base,
DucElementVariant::FreeDraw(elem) => &elem.base,
DucElementVariant::Table(elem) => &elem.base,
DucElementVariant::Plot(elem) => &elem.stack_element_base.base,
DucElementVariant::Doc(elem) => &elem.base,
DucElementVariant::Model(elem) => &elem.base,
DucElementVariant::Embeddable(elem) => &elem.base,
DucElementVariant::Pdf(elem) => &elem.base,
}
}
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(tag = "type")]
pub enum DucElementEnum {
#[serde(rename = "rectangle")]
DucRectangleElement(DucRectangleElement),
#[serde(rename = "polygon")]
DucPolygonElement(DucPolygonElement),
#[serde(rename = "ellipse")]
DucEllipseElement(DucEllipseElement),
#[serde(rename = "embeddable")]
DucEmbeddableElement(DucEmbeddableElement),
#[serde(rename = "pdf")]
DucPdfElement(DucPdfElement),
#[serde(rename = "table")]
DucTableElement(DucTableElement),
#[serde(rename = "image")]
DucImageElement(DucImageElement),
#[serde(rename = "text")]
DucTextElement(DucTextElement),
#[serde(rename = "line")]
DucLinearElement(DucLinearElement),
#[serde(rename = "arrow")]
DucArrowElement(DucArrowElement),
#[serde(rename = "freedraw")]
DucFreeDrawElement(DucFreeDrawElement),
#[serde(rename = "frame")]
DucFrameElement(DucFrameElement),
#[serde(rename = "plot")]
DucPlotElement(DucPlotElement),
#[serde(rename = "doc")]
DucDocElement(DucDocElement),
#[serde(rename = "model")]
DucModelElement(DucModelElement),
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(transparent)]
pub struct ElementWrapper {
pub element: DucElementEnum,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucRectangleElement {
#[serde(flatten)]
pub base: DucElementBase,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucPolygonElement {
#[serde(flatten)]
pub base: DucElementBase,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub sides: i32,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucEllipseElement {
#[serde(flatten)]
pub base: DucElementBase,
pub ratio: f32,
pub start_angle: f64,
pub end_angle: f64,
pub show_aux_crosshair: bool,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucEmbeddableElement {
#[serde(flatten)]
pub base: DucElementBase,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DocumentGridConfig {
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub columns: i32,
pub gap_x: f64,
pub gap_y: f64,
pub first_page_alone: bool,
pub scale: f64,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucPdfElement {
#[serde(flatten)]
pub base: DucElementBase,
pub file_id: Option<String>,
pub grid_config: DocumentGridConfig,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucDocElement {
#[serde(flatten)]
pub base: DucElementBase,
pub style: DucDocStyle,
pub text: String,
pub grid_config: DocumentGridConfig,
pub file_id: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucTableElement {
#[serde(flatten)]
pub base: DucElementBase,
pub style: DucTableStyle,
pub file_id: Option<String>, }
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ImageCrop {
pub x: f64,
pub y: f64,
pub width: f64,
pub height: f64,
pub natural_width: f64,
pub natural_height: f64,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucImageElement {
#[serde(flatten)]
pub base: DucElementBase,
pub file_id: Option<String>,
pub status: IMAGE_STATUS,
#[serde(rename = "scaleFlip")]
pub scale: Vec<f64>,
pub crop: Option<ImageCrop>,
pub filter: Option<DucImageFilter>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucTextElement {
#[serde(flatten)]
pub base: DucElementBase,
pub style: DucTextStyle,
pub text: String,
pub auto_resize: bool,
pub container_id: Option<String>,
pub original_text: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucLinearElement {
#[serde(flatten)]
pub linear_base: DucLinearElementBase,
pub wipeout_below: bool,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucArrowElement {
#[serde(flatten)]
pub linear_base: DucLinearElementBase,
pub elbowed: bool,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucFreeDrawEnds {
pub cap: bool,
pub taper: f32,
pub easing: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucFreeDrawElement {
#[serde(flatten)]
pub base: DucElementBase,
pub points: Vec<DucPoint>,
pub size: f64,
pub thinning: f32,
pub smoothing: f32,
pub streamline: f32,
pub easing: String,
pub start: Option<DucFreeDrawEnds>,
pub end: Option<DucFreeDrawEnds>,
pub pressures: Vec<f32>,
pub simulate_pressure: bool,
pub last_committed_point: Option<DucPoint>,
pub svg_path: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucFrameElement {
#[serde(flatten)]
pub stack_element_base: DucStackElementBase,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PlotLayout {
pub margins: Margins,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucPlotElement {
#[serde(flatten)]
pub stack_element_base: DucStackElementBase,
pub style: DucPlotStyle,
pub layout: PlotLayout,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucModelElement {
#[serde(flatten)]
pub base: DucElementBase,
pub model_type: Option<String>,
pub code: Option<String>,
#[serde(with = "serde_bytes", default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<Vec<u8>>,
pub file_ids: Vec<String>,
pub viewer_state: Option<Viewer3DState>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucBlockDuplicationArray {
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub rows: i32,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub cols: i32,
pub row_spacing: f64,
pub col_spacing: f64,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucBlockMetadata {
pub source: Option<String>,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub usage_count: i32,
pub created_at: i64,
pub updated_at: i64,
pub localization: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucBlock {
pub id: String,
pub label: String,
pub description: Option<String>,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub version: i32,
pub metadata: Option<DucBlockMetadata>,
#[serde(with = "serde_bytes", default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<Vec<u8>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucBlockInstance {
pub id: String,
pub block_id: String,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub version: i32,
pub element_overrides: Option<Vec<StringValueEntry>>,
pub duplication_array: Option<DucBlockDuplicationArray>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucBlockCollectionEntry {
pub id: String,
pub is_collection: bool,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucBlockCollection {
pub id: String,
pub label: String,
pub children: Vec<DucBlockCollectionEntry>,
pub metadata: Option<DucBlockMetadata>,
#[serde(with = "serde_bytes", default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<Vec<u8>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucGroup {
pub id: String,
#[serde(flatten)]
pub stack_base: DucStackBase,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucRegion {
pub id: String,
#[serde(flatten)]
pub stack_base: DucStackBase,
pub boolean_operation: BOOLEAN_OPERATION,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucGlobalState {
pub name: Option<String>,
pub view_background_color: String,
pub main_scope: String,
pub scope_exponent_threshold: i8,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucLocalState {
pub scope: String,
pub scroll_x: f64,
pub scroll_y: f64,
pub zoom: f64,
pub is_binding_enabled: bool,
pub current_item_stroke: Option<ElementStroke>,
pub current_item_background: Option<ElementBackground>,
pub current_item_opacity: f32,
pub current_item_font_family: String,
pub current_item_font_size: f64,
pub current_item_text_align: TEXT_ALIGN,
pub current_item_start_line_head: Option<DucHead>,
pub current_item_end_line_head: Option<DucHead>,
pub current_item_roundness: f64,
pub pen_mode: bool,
pub view_mode_enabled: bool,
pub objects_snap_mode_enabled: bool,
pub grid_mode_enabled: bool,
pub outline_mode_enabled: bool,
pub manual_save_mode: bool,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub decimal_places: i32,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucLayerOverrides {
pub stroke: ElementStroke,
pub background: ElementBackground,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucLayer {
pub id: String,
#[serde(flatten)]
pub stack_base: DucStackBase,
pub readonly: bool,
pub overrides: Option<DucLayerOverrides>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct VersionBase {
pub id: String,
pub parent_id: Option<String>,
pub timestamp: i64,
pub description: Option<String>,
pub is_manual_save: bool,
pub user_id: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Checkpoint {
#[serde(flatten)]
pub base: VersionBase,
pub version_number: i64,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub schema_version: i32,
pub is_schema_boundary: bool,
#[serde(with = "serde_bytes")]
pub data: Vec<u8>,
pub size_bytes: i64,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Delta {
#[serde(flatten)]
pub base: VersionBase,
pub version_number: i64,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub schema_version: i32,
pub base_checkpoint_id: String,
#[serde(with = "serde_bytes")]
pub payload: Vec<u8>,
pub size_bytes: i64,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SchemaMigration {
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub from_schema_version: i32,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub to_schema_version: i32,
pub migration_name: String,
pub migration_checksum: Option<String>,
pub applied_at: i64,
pub boundary_checkpoint_id: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct VersionChain {
pub id: String,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub schema_version: i32,
pub start_version: i64,
pub end_version: Option<i64>,
pub migration: Option<SchemaMigration>,
pub root_checkpoint_id: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct VersionGraphMetadata {
pub current_version: i64,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub current_schema_version: i32,
#[serde(deserialize_with = "crate::serde_utils::trunc_i32")]
pub chain_count: i32,
pub total_size: i64,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct VersionGraph {
pub user_checkpoint_version_id: String,
pub latest_version_id: String,
pub chains: Vec<VersionChain>,
pub checkpoints: Vec<Checkpoint>,
pub deltas: Vec<Delta>,
pub metadata: VersionGraphMetadata,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ExternalFileRevisionMeta {
pub id: String,
pub size_bytes: i64,
pub checksum: Option<String>,
pub source_name: Option<String>,
pub mime_type: String,
pub message: Option<String>,
pub created: i64,
pub last_retrieved: Option<i64>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DucExternalFile {
pub id: String,
pub active_revision_id: String,
pub updated: i64,
pub revisions: HashMap<String, ExternalFileRevisionMeta>,
pub version: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ExternalFileLoaded {
#[serde(flatten)]
pub file: DucExternalFile,
pub data: HashMap<String, serde_bytes::ByteBuf>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ExternalFileMeta {
pub id: String,
pub mime_type: String,
pub created: i64,
pub last_retrieved: Option<i64>,
pub version: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ExportedDataState {
pub id: Option<String>,
pub version: String,
pub source: String,
#[serde(rename = "type")]
pub data_type: String,
pub dictionary: Option<HashMap<String, String>>,
#[serde(with = "serde_bytes", default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<Vec<u8>>,
pub elements: Vec<ElementWrapper>,
pub blocks: Vec<DucBlock>,
pub block_instances: Vec<DucBlockInstance>,
pub block_collections: Vec<DucBlockCollection>,
pub groups: Vec<DucGroup>,
pub regions: Vec<DucRegion>,
pub layers: Vec<DucLayer>,
#[serde(rename = "localState")]
pub duc_local_state: Option<DucLocalState>,
#[serde(rename = "globalState")]
pub duc_global_state: Option<DucGlobalState>,
pub version_graph: Option<VersionGraph>,
#[serde(rename = "files")]
pub external_files: Option<HashMap<String, DucExternalFile>>,
#[serde(rename = "filesData", default, skip_serializing_if = "Option::is_none")]
pub external_files_data: Option<HashMap<String, serde_bytes::ByteBuf>>,
}