/*
 * 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 TaskResponse {
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
    pub created_at: Option<f64>,
    #[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 = "current_turn_id", skip_serializing_if = "Option::is_none")]
    pub current_turn_id: Option<String>,
    #[serde(rename = "has_unread_turn", skip_serializing_if = "Option::is_none")]
    pub has_unread_turn: Option<bool>,
    #[serde(
        rename = "denormalized_metadata",
        skip_serializing_if = "Option::is_none"
    )]
    pub denormalized_metadata: Option<std::collections::HashMap<String, serde_json::Value>>,
    #[serde(rename = "archived")]
    pub archived: bool,
    #[serde(rename = "external_pull_requests")]
    pub external_pull_requests: Vec<models::ExternalPullRequestResponse>,
}

impl TaskResponse {
    pub fn new(
        id: String,
        title: String,
        archived: bool,
        external_pull_requests: Vec<models::ExternalPullRequestResponse>,
    ) -> TaskResponse {
        TaskResponse {
            id,
            created_at: None,
            title,
            has_generated_title: None,
            current_turn_id: None,
            has_unread_turn: None,
            denormalized_metadata: None,
            archived,
            external_pull_requests,
        }
    }
}
