jira_v3_openapi 1.6.0

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

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

/// ApprovalConfiguration : The approval configuration of a status within a workflow. Applies only to Jira Service Management approvals.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ApprovalConfiguration {
    /// Whether the approval configuration is active.
    #[serde(rename = "active")]
    pub active: Active,
    /// How the required approval count is calculated. It may be configured to require a specific number of approvals, or approval by a percentage of approvers. If the approvers source field is Approver groups, you can configure how many approvals per group are required for the request to be approved. The number will be the same across all groups.
    #[serde(rename = "conditionType")]
    pub condition_type: ConditionType,
    /// The number or percentage of approvals required for a request to be approved. If `conditionType` is `number`, the value must be 20 or less. If `conditionType` is `percent`, the value must be 100 or less.
    #[serde(rename = "conditionValue")]
    pub condition_value: String,
    /// A list of roles that should be excluded as possible approvers.
    #[serde(rename = "exclude", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub exclude: Option<Option<Vec<Exclude>>>,
    /// The custom field ID of the \"Approvers\" or \"Approver Groups\" field.
    #[serde(rename = "fieldId")]
    pub field_id: String,
    /// The custom field ID of the field used to pre-populate the Approver field. Only supports the \"Affected Services\" field.
    #[serde(rename = "prePopulatedFieldId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub pre_populated_field_id: Option<Option<String>>,
    /// The numeric ID of the transition to be executed if the request is approved.
    #[serde(rename = "transitionApproved")]
    pub transition_approved: String,
    /// The numeric ID of the transition to be executed if the request is declined.
    #[serde(rename = "transitionRejected")]
    pub transition_rejected: String,
}

impl ApprovalConfiguration {
    /// The approval configuration of a status within a workflow. Applies only to Jira Service Management approvals.
    pub fn new(active: Active, condition_type: ConditionType, condition_value: String, field_id: String, transition_approved: String, transition_rejected: String) -> ApprovalConfiguration {
        ApprovalConfiguration {
            active,
            condition_type,
            condition_value,
            exclude: None,
            field_id,
            pre_populated_field_id: None,
            transition_approved,
            transition_rejected,
        }
    }
}
/// Whether the approval configuration is active.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Active {
    #[serde(rename = "true")]
    True,
    #[serde(rename = "false")]
    False,
}

impl Default for Active {
    fn default() -> Active {
        Self::True
    }
}
/// How the required approval count is calculated. It may be configured to require a specific number of approvals, or approval by a percentage of approvers. If the approvers source field is Approver groups, you can configure how many approvals per group are required for the request to be approved. The number will be the same across all groups.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ConditionType {
    #[serde(rename = "number")]
    Number,
    #[serde(rename = "percent")]
    Percent,
    #[serde(rename = "numberPerPrincipal")]
    NumberPerPrincipal,
}

impl Default for ConditionType {
    fn default() -> ConditionType {
        Self::Number
    }
}
/// A list of roles that should be excluded as possible approvers.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Exclude {
    #[serde(rename = "assignee")]
    Assignee,
    #[serde(rename = "reporter")]
    Reporter,
}

impl Default for Exclude {
    fn default() -> Exclude {
        Self::Assignee
    }
}