using System.Text.Json.Serialization; namespace DigitalData.Core.Application.Abstraction.DTO { /// /// Represents a result of an operation that includes data, inheriting from . /// /// The type of the data included in the result. public class DataResult : Result { /// /// Gets or sets the data included in the result. This property is required. /// It will be ignored during JSON serialization if the value is null. /// [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public required T Data { get; set; } /// /// Converts the current to a failed , /// preserving the messages and notices. /// /// The type of the data in the new failed result. /// A failed with the current messages and notices. public DataResult ToFail() => Fail().Message(Messages).Notice(Notices); } }