/*
 * codex-backend
 *
 * codex-backend
 *
 * The version of the OpenAPI document: 0.0.1
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::Deserialize;
use serde::Serialize;

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TaskListItem {
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "title")]
    pub title: String,
    #[serde(
        rename = "has_generated_title",
        skip_serializing_if = "Option::is_none"
    )]
    pub has_generated_title: Option<bool>,
    #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<f64>,
    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
    pub created_at: Option<f64>,
    #[serde(
        rename = "task_status_display",
        skip_serializing_if = "Option::is_none"
    )]
    pub task_status_display: Option<std::collections::HashMap<String, serde_json::Value>>,
    #[serde(rename = "archived")]
    pub archived: bool,
    #[serde(rename = "has_unread_turn")]
    pub has_unread_turn: bool,
    #[serde(rename = "pull_requests", skip_serializing_if = "Option::is_none")]
    pub pull_requests: Option<Vec<models::ExternalPullRequestResponse>>,
}

impl TaskListItem {
    pub fn new(
        id: String,
        title: String,
        has_generated_title: Option<bool>,
        archived: bool,
        has_unread_turn: bool,
    ) -> TaskListItem {
        TaskListItem {
            id,
            title,
            has_generated_title,
            updated_at: None,
            created_at: None,
            task_status_display: None,
            archived,
            has_unread_turn,
            pull_requests: None,
        }
    }
}
