using System.Collections.Immutable; using StellaOps.Aoc; namespace StellaOps.Concelier.Core.Aoc; /// /// Represents an Aggregation-Only Contract violation produced while validating a raw advisory document. /// public sealed class ConcelierAocGuardException : Exception { public ConcelierAocGuardException(AocGuardResult result) : base("AOC guard validation failed for the provided raw advisory document.") { Result = result ?? throw new ArgumentNullException(nameof(result)); } /// /// Guard evaluation result containing the individual violations. /// public AocGuardResult Result { get; } /// /// Collection of violations returned by the guard. /// public ImmutableArray Violations => Result.Violations; /// /// Primary error code (`ERR_AOC_00x`) associated with the guard failure. /// public string PrimaryErrorCode => Violations.IsDefaultOrEmpty ? "ERR_AOC_000" : Violations[0].ErrorCode; }