request/src/request.validation/Validation.cs

32 lines
944 B
C#
Raw Normal View History

// Copyright (c) The Geekeey Authors
// SPDX-License-Identifier: EUPL-1.2
namespace Geekeey.Request.Validation;
/// <summary>
/// Represents the result of executing one or more validations against a given object or request.
/// </summary>
public sealed class Validation
{
/// <summary>
/// Represents the result of executing one or more validations against a given object or request.
/// </summary>
/// <remarks>
/// This class contains the list of validation problems identified during the validation process.
/// A validation is considered successful if no problems are found.
/// </remarks>
public Validation(IEnumerable<Problem> problems)
{
Problems = [.. problems];
}
/// <summary>
/// Whether the validation was successful.
/// </summary>
public bool IsValid => Problems.Count is 0;
/// <summary>
/// The problems that were found during validation.
/// </summary>
public IReadOnlyList<Problem> Problems { get; }
}