using System.Text.Json.Serialization; namespace DigitalData.Core.Contracts.Application { /// /// Defines a structured format for service messages, categorizing them into success indicators and various types of messages. /// This interface segregates messages into client-facing messages and different levels of logging messages, facilitating targeted communications and diagnostics. /// public interface IServiceMessage { /// /// Gets or sets a flag indicating whether the service operation was successful. /// bool IsSuccess { get; set; } /// /// Gets or sets a collection of messages intended for client display. This is intended to replace the deprecated 'Messages' property. /// List ClientMessages { get; set; } /// /// [Obsolete("Deprecated: Use ClientMessages instead.")] /// Gets or sets a collection of messages associated with the service operation. These messages can be error descriptions, /// success notifications, or other relevant information related to the operation's outcome. /// [Obsolete("Deprecated: Use ClientMessages instead.")] List Messages { get; set; } /// /// Gets or sets a collection of messages used for tracing program execution at a fine-grained level. These are typically voluminous and detailed. /// [JsonIgnore] List TraceMessages { get; set; } /// /// Gets or sets a collection of messages helpful for debugging during development. These messages are often diagnostic. /// [JsonIgnore] List DebugMessages { get; set; } /// /// Gets or sets a collection of informational messages, less critical than warnings, generally used for non-critical notifications. /// [JsonIgnore] List InformationMessages { get; set; } /// /// Gets or sets a collection of messages indicating potential issues that are not necessarily errors, but which may require attention. /// [JsonIgnore] List WarningMessages { get; set; } /// /// Gets or sets a collection of error messages indicating failures or problems within the service. /// [JsonIgnore] List ErrorMessages { get; set; } /// /// Gets or sets a collection of messages indicating critical issues that require immediate attention. /// [JsonIgnore] List CriticalMessages { get; set; } /// /// Adds a new message to the appropriate collection based on the message type. /// /// The message to add. /// The current instance of IServiceMessage, allowing for method chaining. IServiceMessage WithMessage(string message); /// /// Adds a message corresponding to a specified message key to the appropriate collection, facilitating localization and standardization. /// /// The enum value representing the message key. /// The current instance of IServiceMessage, allowing for method chaining. IServiceMessage WithMessageKey(Enum messageKey); } }