use serde::Serialize;
use super::super::handlers::SourceSpan;
use super::statement_types::ProjectionStatementGraph;
#[derive(Debug, Serialize)]
pub struct GraphProjection {
pub steps: Vec<ProjectionStep>,
pub edges: Vec<ProjectionEdge>,
pub child_calls: Vec<ProjectionChildCall>,
}
#[derive(Debug, Serialize)]
pub struct ProjectionStep {
pub name: String,
pub documentation: String,
pub span: SourceSpan,
pub kind: ProjectionStepKind,
pub region: Option<String>,
pub distribution: Option<ProjectionDistribution>,
pub collect: Option<ProjectionCollect>,
pub subflow: Option<ProjectionSubflow>,
pub substeps: Vec<ProjectionSubstepGraph>,
pub visits: Option<String>,
pub decision: bool,
pub waits: bool,
pub activities: Vec<String>,
pub body: ProjectionStatementGraph,
pub failure: Option<ProjectionStatementGraph>,
}
#[derive(Debug, Serialize)]
pub struct ProjectionSubstepGraph {
pub scope: ProjectionSubstepScope,
pub index: usize,
pub graph: GraphProjection,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum ProjectionSubstepScope {
Body,
Failure,
Fork,
Loop,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum ProjectionStepKind {
Plain,
Distribute,
Sequence,
Collect,
SubflowCall,
Decision,
}
#[derive(Debug, Serialize)]
pub struct ProjectionDistribution {
pub binding: String,
pub collection: String,
}
#[derive(Debug, Serialize)]
pub struct ProjectionCollect {
pub binding: String,
pub tolerant: bool,
pub result: String,
}
#[derive(Debug, Serialize)]
pub struct ProjectionSubflow {
pub name: String,
pub graph: Option<GraphProjection>,
}
#[derive(Debug, Serialize)]
pub struct ProjectionEdge {
pub id: String,
pub source: String,
pub target: String,
pub kind: ProjectionEdgeKind,
pub label: Option<String>,
pub back: bool,
pub visits: Option<String>,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum ProjectionEdgeKind {
Route,
FallThrough,
After,
}
#[derive(Debug, Serialize)]
pub struct ProjectionChildCall {
pub id: String,
pub parent_step: String,
pub name: String,
pub signature: String,
pub span: SourceSpan,
}