/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.
 *
 * The version of the OpenAPI document: 1.0.0-rc.3
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct BuildResponse {
    #[serde(rename = "agent", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub agent: Option<Option<String>>,
    #[serde(rename = "artifact_count", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub artifact_count: Option<Option<i32>>,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "duration_ms", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub duration_ms: Option<Option<i64>>,
    #[serde(rename = "finished_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub finished_at: Option<Option<String>>,
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
    pub metadata: Option<serde_json::Value>,
    #[serde(rename = "modules", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub modules: Option<Option<Vec<models::BuildModule>>>,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "number")]
    pub number: i32,
    #[serde(rename = "started_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub started_at: Option<Option<String>>,
    #[serde(rename = "status")]
    pub status: String,
    #[serde(rename = "updated_at")]
    pub updated_at: String,
    #[serde(rename = "vcs_branch", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub vcs_branch: Option<Option<String>>,
    #[serde(rename = "vcs_message", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub vcs_message: Option<Option<String>>,
    #[serde(rename = "vcs_revision", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub vcs_revision: Option<Option<String>>,
    #[serde(rename = "vcs_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub vcs_url: Option<Option<String>>,
}

impl BuildResponse {
    pub fn new(created_at: String, id: uuid::Uuid, name: String, number: i32, status: String, updated_at: String) -> BuildResponse {
        BuildResponse {
            agent: None,
            artifact_count: None,
            created_at,
            duration_ms: None,
            finished_at: None,
            id,
            metadata: None,
            modules: None,
            name,
            number,
            started_at: None,
            status,
            updated_at,
            vcs_branch: None,
            vcs_message: None,
            vcs_revision: None,
            vcs_url: None,
        }
    }
}

