1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
use utoipa::ToSchema;
use uuid::Uuid;

/// Contains information about an image displayed on the base layer.
#[typeshare]
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct BaseLayerImageDto {
    /// The id of the image.
    pub id: Uuid,
    /// The path to the image on Nextcloud.
    pub path: String,
    /// The rotation in degrees (0-360) of the image on the map.
    pub rotation: f32,
    /// The scale of the image on the map.
    pub scale: f32,
    /// The layer the image is on.
    pub layer_id: Uuid,
    /// The x coordinate of the position on the map.
    pub x: i32,
    /// The y coordinate of the position on the map.
    pub y: i32,
}

/// Contains information for updating the `BaseLayerImage`.
#[typeshare]
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct UpdateBaseLayerImageDto {
    /// The layer the image is on.
    pub layer_id: Uuid,
    /// The path to the image on Nextcloud.
    pub path: String,
    /// The rotation in degrees (0-360) of the image on the map.
    pub rotation: f32,
    /// The scale of the image on the map.
    pub scale: f32,
    /// The x coordinate of the position on the map.
    pub x: i32,
    /// The y coordinate of the position on the map.
    pub y: i32,
}

/// Used to delete a base layer image.
#[typeshare]
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct DeleteBaseLayerImageDto {
    /// Id of the base layer image to delete.
    pub id: Uuid,
}