/*
 * API Documentation
 *
 * Source of truth and network automation platform
 *
 * The version of the OpenAPI document: 3.1.0 (3.1)
 *
 * Generated by: https://openapi-generator.tech
 */

/// JobResult : Extends ModelSerializer to render any CustomFields and their values associated with an object.

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct JobResult {
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<uuid::Uuid>,
    #[serde(rename = "object_type", skip_serializing_if = "Option::is_none")]
    pub object_type: Option<String>,
    /// Human friendly display value
    #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
    pub display: Option<String>,
    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
    pub url: Option<String>,
    #[serde(rename = "natural_slug", skip_serializing_if = "Option::is_none")]
    pub natural_slug: Option<String>,
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Box<crate::models::JobResultStatus>>,
    #[serde(rename = "name")]
    pub name: String,
    /// Registered name of the Celery task for this job. Internal use only.
    #[serde(
        rename = "task_name",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub task_name: Option<Option<String>>,
    #[serde(rename = "date_created", skip_serializing_if = "Option::is_none")]
    pub date_created: Option<String>,
    #[serde(
        rename = "date_started",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub date_started: Option<Option<String>>,
    #[serde(
        rename = "date_done",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub date_done: Option<Option<String>>,
    /// The data returned by the task
    #[serde(
        rename = "result",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub result: Option<Option<serde_json::Value>>,
    #[serde(
        rename = "worker",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub worker: Option<Option<String>>,
    #[serde(
        rename = "task_args",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub task_args: Option<Option<serde_json::Value>>,
    #[serde(
        rename = "task_kwargs",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub task_kwargs: Option<Option<serde_json::Value>>,
    #[serde(
        rename = "celery_kwargs",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub celery_kwargs: Option<Option<serde_json::Value>>,
    #[serde(
        rename = "traceback",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub traceback: Option<Option<String>>,
    #[serde(
        rename = "meta",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub meta: Option<Option<serde_json::Value>>,
    #[serde(
        rename = "debug_log_count",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub debug_log_count: Option<Option<i32>>,
    #[serde(
        rename = "success_log_count",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub success_log_count: Option<Option<i32>>,
    #[serde(
        rename = "info_log_count",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub info_log_count: Option<Option<i32>>,
    #[serde(
        rename = "warning_log_count",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub warning_log_count: Option<Option<i32>>,
    #[serde(
        rename = "error_log_count",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub error_log_count: Option<Option<i32>>,
    #[serde(
        rename = "job_model",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub job_model: Option<Option<Box<crate::models::ApprovalWorkflowUser>>>,
    #[serde(
        rename = "user",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub user: Option<Option<Box<crate::models::ApprovalWorkflowUser>>>,
    #[serde(
        rename = "scheduled_job",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub scheduled_job: Option<Option<Box<crate::models::ApprovalWorkflowUser>>>,
    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
    #[serde(rename = "computed_fields", skip_serializing_if = "Option::is_none")]
    pub computed_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
}

impl JobResult {
    /// Extends ModelSerializer to render any CustomFields and their values associated with an object.
    pub fn new(name: String) -> JobResult {
        JobResult {
            id: None,
            object_type: None,
            display: None,
            url: None,
            natural_slug: None,
            status: None,
            name,
            task_name: None,
            date_created: None,
            date_started: None,
            date_done: None,
            result: None,
            worker: None,
            task_args: None,
            task_kwargs: None,
            celery_kwargs: None,
            traceback: None,
            meta: None,
            debug_log_count: None,
            success_log_count: None,
            info_log_count: None,
            warning_log_count: None,
            error_log_count: None,
            job_model: None,
            user: None,
            scheduled_job: None,
            custom_fields: None,
            computed_fields: None,
        }
    }
}
