#[cfg(test)]
use crate::models::Status;

#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct Task {
    pub id: i64,
    pub name: String,
    pub status: String,
    pub story_points: i32,
    pub start_date: String,
    pub end_date: String,
    pub update_date: String,
}

impl Task {
    #[cfg(test)]
    #[allow(dead_code)]
    pub fn new(
        id: i64,
        name: impl Into<String>,
        status: Status,
        story_points: i32,
        start_date: impl Into<String>,
        end_date: impl Into<String>,
        update_date: impl Into<String>,
    ) -> Self {
        Self {
            id,
            name: name.into(),
            status: format!("{}", status),
            story_points,
            start_date: start_date.into(),
            end_date: end_date.into(),
            update_date: update_date.into(),
        }
    }
}
