| | | 1 | | using Bpmn.Interchange; |
| | | 2 | | using JetBrains.Annotations; |
| | | 3 | | |
| | | 4 | | namespace Elsa.Bpmn.Interchange.Endpoints.Bpmn; |
| | | 5 | | |
| | | 6 | | /// <summary>What a document contains and how much of it survives a read, as reported over the API.</summary> |
| | | 7 | | [PublicAPI] |
| | | 8 | | public sealed class BpmnImportAnalysisModel |
| | | 9 | | { |
| | | 10 | | /// <summary>The <c>id</c> of every <c><process></c> in the document, in document order.</summary> |
| | 11 | 11 | | public IReadOnlyCollection<string> ProcessIds { get; init; } = []; |
| | | 12 | | |
| | | 13 | | /// <summary>How many of each BPMN local name were encountered, across all containers.</summary> |
| | 11 | 14 | | public IReadOnlyDictionary<string, int> ElementCounts { get; init; } = new Dictionary<string, int>(); |
| | | 15 | | |
| | | 16 | | /// <summary>Every finding, in the order the reader produced it.</summary> |
| | 11 | 17 | | public IReadOnlyCollection<BpmnImportIssueModel> Issues { get; init; } = []; |
| | | 18 | | |
| | | 19 | | /// <summary>Maps a library analysis onto the API model.</summary> |
| | 3 | 20 | | public static BpmnImportAnalysisModel From(BpmnImportAnalysis analysis) => new() |
| | 3 | 21 | | { |
| | 3 | 22 | | ProcessIds = analysis.ProcessIds.ToList(), |
| | 3 | 23 | | ElementCounts = new Dictionary<string, int>(analysis.ElementCounts), |
| | 3 | 24 | | Issues = analysis.Issues.Select(BpmnImportIssueModel.From).ToList() |
| | 3 | 25 | | }; |
| | | 26 | | } |