using System.Text.Json; namespace StellaOps.Aoc; public static class AocGuardExtensions { public static AocGuardResult ValidateOrThrow(this IAocGuard guard, JsonElement document, AocGuardOptions? options = null) { if (guard is null) { throw new ArgumentNullException(nameof(guard)); } var result = guard.Validate(document, options); if (!result.IsValid) { throw new AocGuardException(result); } return result; } }