/*
 * 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};

/// WorkflowValidationError : The details about a workflow validation error.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WorkflowValidationError {
    /// An error code.
    #[serde(rename = "code", skip_serializing_if = "Option::is_none")]
    pub code: Option<String>,
    #[serde(rename = "elementReference", skip_serializing_if = "Option::is_none")]
    pub element_reference: Option<Box<models::WorkflowElementReference>>,
    /// The validation error level.
    #[serde(rename = "level", skip_serializing_if = "Option::is_none")]
    pub level: Option<Level>,
    /// An error message.
    #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
    /// The type of element the error or warning references.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<Type>,
}

impl WorkflowValidationError {
    /// The details about a workflow validation error.
    pub fn new() -> WorkflowValidationError {
        WorkflowValidationError {
            code: None,
            element_reference: None,
            level: None,
            message: None,
            r#type: None,
        }
    }
}
/// The validation error level.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Level {
    #[serde(rename = "WARNING")]
    Warning,
    #[serde(rename = "ERROR")]
    Error,
}

impl Default for Level {
    fn default() -> Level {
        Self::Warning
    }
}
/// The type of element the error or warning references.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "RULE")]
    Rule,
    #[serde(rename = "STATUS")]
    Status,
    #[serde(rename = "STATUS_LAYOUT")]
    StatusLayout,
    #[serde(rename = "STATUS_PROPERTY")]
    StatusProperty,
    #[serde(rename = "WORKFLOW")]
    Workflow,
    #[serde(rename = "TRANSITION")]
    Transition,
    #[serde(rename = "TRANSITION_PROPERTY")]
    TransitionProperty,
    #[serde(rename = "SCOPE")]
    Scope,
    #[serde(rename = "STATUS_MAPPING")]
    StatusMapping,
    #[serde(rename = "TRIGGER")]
    Trigger,
}

impl Default for Type {
    fn default() -> Type {
        Self::Rule
    }
}

