use serde::{Deserialize, Serialize};
use crate::api::serialize::todoist_rfc3339;
use super::{ProjectID, TaskID};
pub type CommentID = String;
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(untagged)]
pub enum ThreadID {
Project {
project_id: ProjectID,
},
Task {
task_id: TaskID,
},
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Comment {
pub id: CommentID,
pub item_id: Option<TaskID>,
pub project_id: Option<ProjectID>,
#[serde(serialize_with = "todoist_rfc3339")]
pub posted_at: chrono::DateTime<chrono::Utc>,
pub content: String,
pub attachment: Option<Attachment>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Attachment {}
#[derive(Debug, Serialize)]
pub struct CreateComment {
#[serde(flatten)]
pub thread: ThreadID,
pub content: String,
}