use nanoserde::DeJson;
use std::collections::HashMap;
#[derive(Clone, Debug, Default, DeJson)]
#[nserde(default)]
pub struct Chunk {
pub data: Vec<u32>,
pub height: usize,
pub width: usize,
pub x: i32,
pub y: i32,
}
#[derive(Clone, Debug, Default, DeJson)]
#[nserde(default)]
pub struct Layer {
pub chunks: Option<Vec<Chunk>>,
pub name: String,
pub opacity: f32,
pub properties: Option<HashMap<String, String>>,
pub visible: bool,
pub width: u32,
pub height: u32,
#[nserde(rename = "type")]
pub ty: String,
pub data: Vec<u32>,
pub draworder: Option<String>,
#[nserde(default)]
pub objects: Vec<Object>,
pub offsetx: Option<i32>,
pub offsety: Option<i32>,
pub x: Option<f32>,
pub y: Option<f32>,
pub image: Option<String>,
}
#[derive(Clone, Debug, Default, DeJson)]
#[nserde(default)]
pub struct Property {
pub name: String,
#[nserde(rename = "type")]
pub ty: String,
pub value: String,
}
#[derive(Clone, Debug, Default, DeJson)]
#[nserde(default)]
pub struct Object {
pub id: u32,
pub name: String,
#[nserde(rename = "type")]
pub ty: String,
pub gid: Option<u32>,
pub ellipse: Option<bool>,
pub polygon: Option<Vec<PolyPoint>>,
pub properties: Vec<Property>,
pub rotation: f32,
pub visible: bool,
pub height: f32,
pub width: f32,
pub x: f32,
pub y: f32,
}
#[derive(Copy, Clone, Debug, DeJson)]
pub struct PolyPoint {
pub x: f32,
pub y: f32,
}