use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Deserialize)]
pub struct LabelWorkspaceRef {
pub id: String,
#[serde(default)]
pub name: Option<String>,
#[serde(default)]
pub slug: Option<String>,
#[serde(rename = "type", default)]
pub workspace_type: Option<String>,
#[serde(default)]
pub logo: Option<String>,
#[serde(default)]
pub timezone: Option<String>,
#[serde(default)]
pub language: Option<String>,
}
#[derive(Debug, Clone, Deserialize)]
pub struct Label {
pub id: String,
pub name: String,
#[serde(default)]
pub color: Option<String>,
#[serde(default)]
pub workspace: Option<LabelWorkspaceRef>,
#[serde(default)]
pub created_at: Option<String>,
#[serde(default)]
pub updated_at: Option<String>,
}
#[derive(Debug, Clone, Serialize)]
pub struct CreateLabel {
pub workspace_id: String,
pub name: String,
pub color: String,
}
impl CreateLabel {
pub fn new(
workspace_id: impl Into<String>,
name: impl Into<String>,
color: impl Into<String>,
) -> Self {
Self {
workspace_id: workspace_id.into(),
name: name.into(),
color: color.into(),
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct UpdateLabel {
pub name: String,
pub color: String,
}
impl UpdateLabel {
pub fn new(name: impl Into<String>, color: impl Into<String>) -> Self {
Self {
name: name.into(),
color: color.into(),
}
}
}