use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct SpawnPlacementResponse {
pub global_x: i32,
pub global_y: i32,
pub width: u32,
pub height: u32,
pub monitor_label: String,
pub slot_index: usize,
pub slot_label: String,
pub source: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub decorations: Option<bool>,
}
impl SpawnPlacementResponse {
#[allow(clippy::too_many_arguments)]
pub fn new(
global_x: i32,
global_y: i32,
width: u32,
height: u32,
monitor_label: String,
slot_index: usize,
slot_label: String,
source: String,
) -> Self {
Self {
global_x,
global_y,
width,
height,
monitor_label,
slot_index,
slot_label,
source,
decorations: None,
}
}
#[must_use]
pub fn with_decorations(mut self, decorations: Option<bool>) -> Self {
self.decorations = decorations;
self
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct SpawnPlacementPreviewQuery {
pub slot: usize,
#[serde(default)]
pub overflow: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct TempPlacementLookupQuery {
pub index: usize,
#[serde(default)]
pub overflow: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct TempPlacementsListResponse<P = serde_json::Value> {
pub placements: Vec<P>,
pub count: usize,
}
impl<P> TempPlacementsListResponse<P> {
pub fn new(placements: Vec<P>) -> Self {
let count = placements.len();
Self { placements, count }
}
}