1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use crate::task::JobInstanceState;
use crate::workflow::Workflow;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use wakflo_common::{JobMetadata, JobProcessStatus, SystemActivityLog};

/// # WorkflowInstance
///
/// A running instance of a schema entity
#[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug)]
pub struct WorkflowInstance {
    /// Unique identifier of a schema
    pub id: String,

    /// Workflow that owns this schema
    pub workflow_id: String,

    /// Workflow that owns this schema
    pub workflow: Option<Workflow>,

    pub state: JobInstanceState,

    /// Actual state of the schema [JobProcessStatus]
    pub status: JobProcessStatus,

    pub team_id: String,

    /// Execution result
    pub input: HashMap<String, serde_json::Value>,

    pub errors: Vec<SystemActivityLog>,

    pub output: HashMap<String, serde_json::Value>,

    /// [JobMetadata] data for job
    pub metadata: JobMetadata,

    /// [OwnerMetadata] owner data for entity
    pub created_by: Option<String>,

    /// [OwnerMetadata] owner data for entity
    pub updated_by: Option<String>,

    /// Date the entity was created
    pub created_at: chrono::DateTime<chrono::FixedOffset>,

    /// Date the entity was updated
    pub updated_at: chrono::DateTime<chrono::FixedOffset>,
}