Skip to main content

orvanta_api/models/
cmmn_plan_item_instance.rs

1/*
2 * Orvanta API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 4.1.0
7 * Contact: contact@orvanta.cloud
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// CmmnPlanItemInstance : One live plan-item instance inside a case.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CmmnPlanItemInstance {
17    /// Index into `CmmnCaseInstance.instances`; stable for the case's lifetime.
18    #[serde(rename = "idx")]
19    pub idx: i32,
20    #[serde(rename = "plan_item_id")]
21    pub plan_item_id: String,
22    #[serde(rename = "definition_id")]
23    pub definition_id: String,
24    #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub name: Option<Option<String>>,
26    #[serde(rename = "def_kind")]
27    pub def_kind: models::CmmnDefinitionKind,
28    /// Which transition table governs this instance. `Milestone` is deliberately **not** an event listener.
29    #[serde(rename = "kind")]
30    pub kind: Kind,
31    #[serde(rename = "state")]
32    pub state: models::CmmnPlanItemState,
33    /// Enclosing stage instance; `null` for the case plan model's own children, whose container is the case.
34    #[serde(rename = "parent", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
35    pub parent: Option<Option<i32>>,
36    #[serde(rename = "repetition_counter")]
37    pub repetition_counter: i32,
38    /// Local variables. Holds `repetitionCounter` under the name the model asked for (`flowable:counterVariable`, else the Flowable default).
39    #[serde(rename = "local_variables")]
40    pub local_variables: std::collections::HashMap<String, serde_json::Value>,
41    /// Sentry on-part ids satisfied so far, keyed by **criterion** id, not sentry id: one sentry may be attached by several criteria and each attachment latches independently.
42    #[serde(rename = "satisfied_on_parts")]
43    pub satisfied_on_parts: std::collections::HashMap<String, Vec<String>>,
44    #[serde(rename = "satisfied_if_parts")]
45    pub satisfied_if_parts: Vec<String>,
46    #[serde(rename = "completable")]
47    pub completable: bool,
48    /// The state held immediately before this instance was suspended, so `resume`/`parentResume` restores it exactly (#1292). Absent on a case suspended before the field existed, in which case `resume` falls back to `available`.
49    #[serde(rename = "state_before_suspend", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
50    pub state_before_suspend: Option<Option<models::CmmnPlanItemState>>,
51}
52
53impl CmmnPlanItemInstance {
54    /// One live plan-item instance inside a case.
55    pub fn new(idx: i32, plan_item_id: String, definition_id: String, def_kind: models::CmmnDefinitionKind, kind: Kind, state: models::CmmnPlanItemState, repetition_counter: i32, local_variables: std::collections::HashMap<String, serde_json::Value>, satisfied_on_parts: std::collections::HashMap<String, Vec<String>>, satisfied_if_parts: Vec<String>, completable: bool) -> CmmnPlanItemInstance {
56        CmmnPlanItemInstance {
57            idx,
58            plan_item_id,
59            definition_id,
60            name: None,
61            def_kind,
62            kind,
63            state,
64            parent: None,
65            repetition_counter,
66            local_variables,
67            satisfied_on_parts,
68            satisfied_if_parts,
69            completable,
70            state_before_suspend: None,
71        }
72    }
73}
74/// Which transition table governs this instance. `Milestone` is deliberately **not** an event listener.
75#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
76pub enum Kind {
77    #[serde(rename = "PlanItem")]
78    PlanItem,
79    #[serde(rename = "EventListener")]
80    EventListener,
81}
82
83impl Default for Kind {
84    fn default() -> Kind {
85        Self::PlanItem
86    }
87}
88