/*
 * The Jira Cloud platform REST API
 *
 * Jira Cloud platform REST API documentation
 *
 * The version of the OpenAPI document: 1001.0.0-SNAPSHOT-48dd1e2d75e7eac65741e465279d2700f927137d
 * Contact: ecosystem@atlassian.com
 * Generated by: https://openapi-generator.tech
 */

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

/// WorkflowUpdate : The details of the workflows to update.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WorkflowUpdate {
    /// The mapping of old to new status ID.
    #[serde(rename = "defaultStatusMappings", skip_serializing_if = "Option::is_none")]
    pub default_status_mappings: Option<Vec<models::StatusMigration>>,
    /// The new description for this workflow.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// The ID of this workflow.
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "startPointLayout", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub start_point_layout: Option<Option<Box<models::WorkflowLayout>>>,
    /// The mapping of old to new status ID for a specific project and issue type.
    #[serde(rename = "statusMappings", skip_serializing_if = "Option::is_none")]
    pub status_mappings: Option<Vec<models::StatusMappingDto>>,
    /// The statuses associated with this workflow.
    #[serde(rename = "statuses")]
    pub statuses: Vec<models::StatusLayoutUpdate>,
    /// The transitions of this workflow.
    #[serde(rename = "transitions")]
    pub transitions: Vec<models::TransitionUpdateDto>,
    #[serde(rename = "version")]
    pub version: Box<models::DocumentVersion>,
}

impl WorkflowUpdate {
    /// The details of the workflows to update.
    pub fn new(id: String, statuses: Vec<models::StatusLayoutUpdate>, transitions: Vec<models::TransitionUpdateDto>, version: models::DocumentVersion) -> WorkflowUpdate {
        WorkflowUpdate {
            default_status_mappings: None,
            description: None,
            id,
            start_point_layout: None,
            status_mappings: None,
            statuses,
            transitions,
            version: Box::new(version),
        }
    }
}

