/*
* Zernio API
*
* API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
*
* The version of the OpenAPI document: 1.603.1
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// AutomationApproval : A request an automation sent for a person's approval before acting, with each change it holds.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AutomationApproval {
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "automationId")]
pub automation_id: String,
/// The check that found the matches and sent the request.
#[serde(rename = "checkId")]
pub check_id: String,
/// `cancelled` when the automation stopped asking for approval before anyone decided.
#[serde(rename = "status")]
pub status: Status,
/// The emails the request was sent to.
#[serde(rename = "to")]
pub to: Vec<String>,
/// After this the request can no longer be decided and its changes are skipped.
#[serde(rename = "expiresAt")]
pub expires_at: String,
#[serde(rename = "createdAt")]
pub created_at: String,
#[serde(rename = "decidedBy")]
pub decided_by: Box<models::AutomationApprovalDecidedBy>,
#[serde(rename = "decidedAt", deserialize_with = "Option::deserialize")]
pub decided_at: Option<String>,
/// True when the request is pending and you are one of the approvers the automation names now.
#[serde(rename = "canDecide")]
pub can_decide: bool,
/// The changes the request holds. Notifications are not listed.
#[serde(rename = "changes")]
pub changes: Vec<models::AutomationApprovalChange>,
}
impl AutomationApproval {
/// A request an automation sent for a person's approval before acting, with each change it holds.
pub fn new(
id: String,
automation_id: String,
check_id: String,
status: Status,
to: Vec<String>,
expires_at: String,
created_at: String,
decided_by: models::AutomationApprovalDecidedBy,
decided_at: Option<String>,
can_decide: bool,
changes: Vec<models::AutomationApprovalChange>,
) -> AutomationApproval {
AutomationApproval {
id,
automation_id,
check_id,
status,
to,
expires_at,
created_at,
decided_by: Box::new(decided_by),
decided_at,
can_decide,
changes,
}
}
}
/// `cancelled` when the automation stopped asking for approval before anyone decided.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "pending")]
Pending,
#[serde(rename = "approved")]
Approved,
#[serde(rename = "rejected")]
Rejected,
#[serde(rename = "expired")]
Expired,
#[serde(rename = "cancelled")]
Cancelled,
}
impl Default for Status {
fn default() -> Status {
Self::Pending
}
}