using System.Text.Json.Serialization; namespace BizProcessDAL.DTO { // Matches gb4.7mfe's ProcessMapViewer JSON contract exactly (verified against // processmapviewer.json / processmapviewer.component.ts's loadProcess()) so Phase 3 // (wiring ProcessMapViewer to this endpoint) needs no FE parsing-logic changes — // only property casing here, JsonPropertyName pins it regardless of GB5's global // PropertyNamingPolicy=null convention (which would otherwise emit PascalCase). public class ProcessMapDTO { [JsonPropertyName("type")] public string Type { get; set; } = "flowchart"; [JsonPropertyName("nodes")] public List Nodes { get; set; } = new(); [JsonPropertyName("edges")] public List Edges { get; set; } = new(); [JsonPropertyName("styles")] public List Styles { get; set; } = new(); [JsonPropertyName("subgraphs")] public List Subgraphs { get; set; } = new(); } public class ProcessMapNodeDTO { [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; [JsonPropertyName("label")] public string Label { get; set; } = string.Empty; // shapetype: round/rhombus/subroutine/stadium — Gateway/Decision->rhombus, // SubProcess->subroutine, default->round (mapped from StageType in the BLL). [JsonPropertyName("shapetype")] public string ShapeType { get; set; } = "round"; [JsonPropertyName("menuType")] public string? MenuType { get; set; } [JsonPropertyName("menuName")] public string? MenuName { get; set; } [JsonPropertyName("menuId")] public int MenuId { get; set; } = -1; [JsonPropertyName("index")] public int Index { get; set; } [JsonPropertyName("reportFieldName")] public string? ReportFieldName { get; set; } // Populated only for STAGETYPE=SubProcess stages. Confirmed against the real // processmapviewer.json contract: this is ALWAYS an array (empty when none, a // single-element array when populated) — showNodeDetails() in the FE component // uses nodeObj[0].subprocess directly as the next processMapData value with no // extra unwrapping, so the shape must match exactly, not a bare nullable object. [JsonPropertyName("subprocess")] public List Subprocess { get; set; } = new(); // ── Phase 6/8 operational overlay fields — additive, optional ── [JsonPropertyName("hasWorkflow")] public bool? HasWorkflow { get; set; } [JsonPropertyName("workflowId")] public int? WorkflowId { get; set; } [JsonPropertyName("openCount")] public int? OpenCount { get; set; } } public class ProcessMapEdgeDTO { [JsonPropertyName("from")] public string From { get; set; } = string.Empty; [JsonPropertyName("to")] public string To { get; set; } = string.Empty; [JsonPropertyName("connectionlabel")] public string? ConnectionLabel { get; set; } } public class ProcessMapStyleDTO { [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; [JsonPropertyName("style")] public string Style { get; set; } = string.Empty; } }