namespace DigitalData.Core.Contracts.Application
{
///
/// Defines the base functionality for a service, including creating service messages and results.
///
public interface IResponseService
{
#region WITHOUT_MESSAGE
///
/// Creates a simple service message indicating success or failure without any additional messages.
///
/// Indicates if the operation was successful.
/// A service message indicating the outcome of the operation without any messages.
IServiceMessage CreateMessage(bool isSuccess);
///
/// Creates a service result with the specified data and a success flag, without any additional messages.
///
/// The type of data the service result will contain.
/// The data for the service result.
/// Indicates if the operation was successful.
/// A service result containing the data and indicating the outcome of the operation without any messages.
IServiceResult CreateResult(T? data, bool isSuccess);
///
/// Creates a service message indicating a successful operation without any messages.
///
/// A service message indicating a successful operation.
IServiceMessage Successful();
///
/// Creates a service message indicating a failed operation without any messages.
///
/// A service message indicating a failed operation.
IServiceMessage Failed();
///
/// Creates a successful service result with the specified data, without any messages.
///
/// The type of data the service result will contain.
/// The data to include in the service result.
/// A successful service result containing the data, indicating a successful operation without any messages.
IServiceResult Successful(T data);
///
/// Creates a failed service result, optionally including data, without any messages.
///
/// The type of data the service result can contain.
/// Optional data to include in the failed service result.
/// A failed service result, which may or may not contain data, indicating a failed operation without any messages.
IServiceResult Failed(T? data = default);
#endregion
#region WITH_STRING_MESSAGE
///
/// Creates a service message.
///
/// Indicates if the operation was successful.
/// The messages associated with the operation.
/// A service message indicating the outcome of the operation and any associated messages.
IServiceMessage CreateMessage(bool isSuccess, params string[] messages);
///
/// Creates a service result with the specified data.
///
/// The type of data the service result will contain.
/// The data for the service result.
/// Indicates if the operation was successful.
/// The messages associated with the operation.
/// A service result containing the data and indicating the outcome of the operation.
IServiceResult CreateResult(T? data, bool isSuccess, params string[] messages);
///
/// Creates a successful service message.
///
/// The success messages.
/// A successful service message.
IServiceMessage Successful(params string[] messages);
///
/// Creates a failed service message.
///
/// The failure messages.
/// A failed service message.
IServiceMessage Failed(params string[] messages);
///
/// Creates a successful service result with the specified data.
///
/// The type of data the service result will contain.
/// The data to include in the service result.
/// The success messages.
/// A successful service result containing the data.
IServiceResult Successful(T data, params string[] messages);
///
/// Creates a failed service result, optionally including data.
///
/// The type of data the service result can contain.
/// Optional data to include in the failed service result.
/// The failure messages.
/// A failed service result, which may or may not contain data.
IServiceResult Failed(T? data = default, params string[] messages);
///
/// Creates a failed service result without explicitly including data, using only failure messages.
///
///
/// This overload is useful when you want to indicate a failure without the need to return any specific data,
/// but still want to provide details about the failure through messages.
///
/// The type of data the service result can contain. The result will contain the default value for this type.
/// An array of failure messages associated with the operation. These provide detail about why the operation failed.
/// A failed service result. The data part of the result will be set to the default value for the specified type.
IServiceResult Failed(params string[] messages);
#endregion
#region WITH_ENUM_MESSAGE
///
/// Creates a service message using enumeration values.
///
/// Indicates if the operation was successful.
/// The enumeration values associated with the operation.
/// A service message indicating the outcome of the operation and any associated enumeration values.
IServiceMessage CreateMessage(bool isSuccess, params Enum[] messages);
///
/// Creates a service result with the specified data and enumeration values for messages.
///
/// The type of data the service result will contain.
/// The data for the service result.
/// Indicates if the operation was successful.
/// The enumeration values associated with the operation.
/// A service result containing the data and indicating the outcome of the operation with enumeration values.
IServiceResult CreateResult(T? data, bool isSuccess, params Enum[] messages);
///
/// Creates a successful service message using enumeration values.
///
/// The success enumeration values.
/// A successful service message.
IServiceMessage Successful(params Enum[] messages);
///
/// Creates a failed service message using enumeration values.
///
/// The failure enumeration values.
/// A failed service message.
IServiceMessage Failed(params Enum[] messages);
///
/// Creates a successful service result with the specified data, using enumeration values for messages.
///
/// The type of data the service result will contain.
/// The data to include in the service result.
/// The success enumeration values.
/// A successful service result containing the data.
IServiceResult Successful(T data, params Enum[] messages);
///
/// Creates a failed service result, optionally including data, using enumeration values for messages.
///
/// The type of data the service result can contain.
/// Optional data to include in the failed service result.
/// The failure enumeration values.
/// A failed service result, which may or may not contain data.
IServiceResult Failed(T? data = default, params Enum[] messages);
///
/// Creates a failed service result without explicitly including data, using only enumeration values for failure messages.
///
///
/// This overload is useful when you want to indicate a failure without the need to return any specific data,
/// but still want to provide details about the failure through enumeration values.
///
/// The type of data the service result can contain. The result will contain the default value for this type.
/// An array of enumeration values associated with the operation. These provide detail about why the operation failed.
/// A failed service result. The data part of the result will be set to the default value for the specified type.
IServiceResult Failed(params Enum[] messages);
#endregion
}
}