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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct BulkOperationProgress {
    /// A timestamp of when the task was submitted.
    #[serde(rename = "created", skip_serializing_if = "Option::is_none")]
    pub created: Option<String>,
    /// Map of issue IDs for which the operation failed and that the user has permission to view, to their one or more reasons for failure. These reasons are open-ended text descriptions of the error and are not selected from a predefined list of standard reasons.
    #[serde(rename = "failedAccessibleIssues", skip_serializing_if = "Option::is_none")]
    pub failed_accessible_issues: Option<std::collections::HashMap<String, Vec<String>>>,
    /// The number of issues that are either invalid or issues that the user doesn't have permission to view, regardless of the success or failure of the operation.
    #[serde(rename = "invalidOrInaccessibleIssueCount", skip_serializing_if = "Option::is_none")]
    pub invalid_or_inaccessible_issue_count: Option<i32>,
    /// List of issue IDs for which the operation was successful and that the user has permission to view.
    #[serde(rename = "processedAccessibleIssues", skip_serializing_if = "Option::is_none")]
    pub processed_accessible_issues: Option<Vec<i64>>,
    /// Progress of the task as a percentage.
    #[serde(rename = "progressPercent", skip_serializing_if = "Option::is_none")]
    pub progress_percent: Option<i64>,
    /// A timestamp of when the task was started.
    #[serde(rename = "started", skip_serializing_if = "Option::is_none")]
    pub started: Option<String>,
    /// The status of the task.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Status>,
    #[serde(rename = "submittedBy", skip_serializing_if = "Option::is_none")]
    pub submitted_by: Option<Box<models::User>>,
    /// The ID of the task.
    #[serde(rename = "taskId", skip_serializing_if = "Option::is_none")]
    pub task_id: Option<String>,
    /// The number of issues that the bulk operation was attempted on.
    #[serde(rename = "totalIssueCount", skip_serializing_if = "Option::is_none")]
    pub total_issue_count: Option<i32>,
    /// A timestamp of when the task progress was last updated.
    #[serde(rename = "updated", skip_serializing_if = "Option::is_none")]
    pub updated: Option<String>,
}

impl BulkOperationProgress {
    pub fn new() -> BulkOperationProgress {
        BulkOperationProgress {
            created: None,
            failed_accessible_issues: None,
            invalid_or_inaccessible_issue_count: None,
            processed_accessible_issues: None,
            progress_percent: None,
            started: None,
            status: None,
            submitted_by: None,
            task_id: None,
            total_issue_count: None,
            updated: None,
        }
    }
}
/// The status of the task.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "ENQUEUED")]
    Enqueued,
    #[serde(rename = "RUNNING")]
    Running,
    #[serde(rename = "COMPLETE")]
    Complete,
    #[serde(rename = "FAILED")]
    Failed,
    #[serde(rename = "CANCEL_REQUESTED")]
    CancelRequested,
    #[serde(rename = "CANCELLED")]
    Cancelled,
    #[serde(rename = "DEAD")]
    Dead,
}

impl Default for Status {
    fn default() -> Status {
        Self::Enqueued
    }
}

