/*
* Orvanta API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 6.5.0
* Contact: contact@orvanta.cloud
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// ProcessHistoryEntry : One per-element transition record, in chronological (push) order. **Populated by the engine since #421**, correcting the text that stood here until #1613 (\"Not currently populated by the engine -- always an empty array today\"). That sentence was true of the Phase 5 Task 3 contract and stopped being true when the engine gained a persisted transition log; it outlived the change, and the run overlay was built to infer edge state from element state on the strength of it. Bounded at 2000 records (`worker_bpmn::MAX_HISTORY`), oldest dropped first, so a long-running or heavily looping instance carries the most recent window rather than its whole run.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ProcessHistoryEntry {
#[serde(rename = "element_id")]
pub element_id: String,
#[serde(rename = "transition")]
pub transition: String,
/// The incoming sequence flow the token arrived at this element by (#1613). Not keyed to the transition kind (#1627): the engine snapshots the token's arrival flow once per visit and stamps it on whichever record that visit produces -- `entered`, `completed` or `failed` alike. Absent only where there is no arrival flow to name: a token freshly created at a start event, a multi-instance body token, and the records written on the async job-resume path. This is what makes per-edge run state a fact rather than an inference. From element state alone a traversal is only derivable as \"source completed AND target now active\", which cannot express a parallel join mid-execution (the branch that already delivered reads idle) or a re-traversed loop-back (indistinguishable from a single pass). The engine records an `entered` on a converging gateway for every arrival, satisfying or not, so each delivered branch is named here by its own flow id; and a loop-back is two `entered` records with the same `via_flow` and different `at`.
#[serde(rename = "via_flow", skip_serializing_if = "Option::is_none")]
pub via_flow: Option<String>,
/// why this transition is not what it looks like. Set only by a `noop` delegate binding today (#923): the activity reports `completed` without having run anything, and this carries the binding's mandatory reason.
#[serde(rename = "note", skip_serializing_if = "Option::is_none")]
pub note: Option<String>,
#[serde(rename = "at")]
pub at: String,
}
impl ProcessHistoryEntry {
/// One per-element transition record, in chronological (push) order. **Populated by the engine since #421**, correcting the text that stood here until #1613 (\"Not currently populated by the engine -- always an empty array today\"). That sentence was true of the Phase 5 Task 3 contract and stopped being true when the engine gained a persisted transition log; it outlived the change, and the run overlay was built to infer edge state from element state on the strength of it. Bounded at 2000 records (`worker_bpmn::MAX_HISTORY`), oldest dropped first, so a long-running or heavily looping instance carries the most recent window rather than its whole run.
pub fn new(element_id: String, transition: String, at: String) -> ProcessHistoryEntry {
ProcessHistoryEntry {
element_id,
transition,
via_flow: None,
note: None,
at,
}
}
}