|
| 1 | +namespace Sigtran.NET.Core.Utilities; |
| 2 | + |
| 3 | +/// <summary> |
| 4 | +/// Provides commercial evidence execution orchestration status reporting. |
| 5 | +/// </summary> |
| 6 | +public static class SigtranCommercialEvidenceExecutionStatus |
| 7 | +{ |
| 8 | + private static readonly string[] Capabilities = |
| 9 | + [ |
| 10 | + "execution-run-identity", |
| 11 | + "execution-stage-catalog", |
| 12 | + "operator-command-plan", |
| 13 | + "execution-environment-contract", |
| 14 | + "artifact-collection-manifest", |
| 15 | + "digest-redaction-verification", |
| 16 | + "blocker-classification", |
| 17 | + "retry-resume-policy", |
| 18 | + "documentation" |
| 19 | + ]; |
| 20 | + |
| 21 | + private static readonly string[] DefaultBlockers = |
| 22 | + [ |
| 23 | + "real-execution-artifacts-required", |
| 24 | + "status-final-validation-pending" |
| 25 | + ]; |
| 26 | + |
| 27 | + /// <summary>The status label.</summary> |
| 28 | + public const string StatusLabel = "Commercial Evidence Execution Orchestration"; |
| 29 | + |
| 30 | + /// <summary>The number of completed commercial evidence execution orchestration work units.</summary> |
| 31 | + public const int CompletedUnitCount = 9; |
| 32 | + |
| 33 | + /// <summary>Returns the completed execution orchestration capability names.</summary> |
| 34 | + /// <returns>The completed capability names.</returns> |
| 35 | + public static IReadOnlyList<string> GetCompletedCapabilities() |
| 36 | + { |
| 37 | + return Capabilities.ToArray(); |
| 38 | + } |
| 39 | + |
| 40 | + /// <summary>Returns default blockers for commercial publication.</summary> |
| 41 | + /// <returns>The default commercial publication blockers.</returns> |
| 42 | + public static IReadOnlyList<string> GetDefaultBlockers() |
| 43 | + { |
| 44 | + return DefaultBlockers.ToArray(); |
| 45 | + } |
| 46 | + |
| 47 | + /// <summary>Whether the default execution orchestration contracts are ready.</summary> |
| 48 | + public static bool ExecutionOrchestrationReady |
| 49 | + { |
| 50 | + get |
| 51 | + { |
| 52 | + SigtranCommercialEvidenceExecutionRun run = CreateDefaultRun(); |
| 53 | + SigtranCommercialEvidenceExecutionStageCatalog catalog = SigtranCommercialEvidenceExecutionStages.CreateDefault(run); |
| 54 | + SigtranCommercialEvidenceExecutionCommandPlan commandPlan = SigtranCommercialEvidenceExecutionCommands.CreateDefault(catalog); |
| 55 | + SigtranCommercialEvidenceExecutionEnvironmentContract environment = SigtranCommercialEvidenceExecutionEnvironments.CreateDefault(run); |
| 56 | + SigtranCommercialEvidenceExecutionArtifactManifest artifacts = SigtranCommercialEvidenceExecutionArtifacts.CreateDefault(catalog); |
| 57 | + SigtranCommercialEvidenceExecutionVerificationPlan verification = SigtranCommercialEvidenceExecutionVerifications.CreateDefault(artifacts); |
| 58 | + SigtranCommercialEvidenceExecutionBlockerClassifier blockerClassifier = SigtranCommercialEvidenceExecutionBlockers.CreateDefault(); |
| 59 | + SigtranCommercialEvidenceExecutionRetryPolicy retryPolicy = SigtranCommercialEvidenceExecutionRetryPolicies.CreateDefault(catalog); |
| 60 | + |
| 61 | + return Capabilities.Length == CompletedUnitCount |
| 62 | + && run.IsReady |
| 63 | + && catalog.IsReady |
| 64 | + && commandPlan.IsReady |
| 65 | + && environment.IsReady |
| 66 | + && artifacts.IsReady |
| 67 | + && verification.IsReady |
| 68 | + && blockerClassifier.IsReady |
| 69 | + && retryPolicy.IsReady; |
| 70 | + } |
| 71 | + } |
| 72 | + |
| 73 | + /// <summary>Whether retained real execution evidence is available in the default status.</summary> |
| 74 | + public static bool RetainedExecutionEvidenceReady => false; |
| 75 | + |
| 76 | + /// <summary>Whether the current default status can publish a commercial package.</summary> |
| 77 | + public static bool CommercialPublicationReady => ExecutionOrchestrationReady |
| 78 | + && RetainedExecutionEvidenceReady |
| 79 | + && DefaultBlockers.Length == 0; |
| 80 | + |
| 81 | + /// <summary>Formats a compact commercial evidence execution orchestration summary.</summary> |
| 82 | + /// <returns>The commercial evidence execution orchestration summary.</returns> |
| 83 | + public static string Describe() |
| 84 | + { |
| 85 | + return $"{StatusLabel}: completedUnits={CompletedUnitCount} capabilities={Capabilities.Length} orchestrationReady={ExecutionOrchestrationReady} retainedEvidenceReady={RetainedExecutionEvidenceReady} commercialPublicationReady={CommercialPublicationReady} blockers={DefaultBlockers.Length}"; |
| 86 | + } |
| 87 | + |
| 88 | + private static SigtranCommercialEvidenceExecutionRun CreateDefaultRun() |
| 89 | + { |
| 90 | + return SigtranCommercialEvidenceExecutionRuns.CreateReleaseCandidateRun( |
| 91 | + "1.0.0-rc.1", |
| 92 | + "abcdef123456", |
| 93 | + "run-20260622-001", |
| 94 | + "release-automation", |
| 95 | + DateTimeOffset.UtcNow); |
| 96 | + } |
| 97 | +} |
0 commit comments