namespace Entities.DTO
{
	public class ApiResponse
	{
		public ApiResponse(string message, bool status = false)
	: this(status, message, null) { }


		public ApiResponse(bool status, object result)
			: this(status, string.Empty, result) { }



		/// <summary>
		/// 创建一个表示成功响应的 ApiResponse 实例。
		/// </summary>
		/// <param name="message">成功消息。</param>
		/// <param name="result">可选的返回数据。</param>
		/// <returns>ApiResponse 实例。</returns>
		public static ApiResponse Success(string message = "操作成功。", object? result = null)
		{
			return new ApiResponse(true, message, result);
		}

		/// <summary>
		/// 创建一个表示失败响应的 ApiResponse 实例。
		/// </summary>
		/// <param name="message">错误消息。</param>
		/// <param name="result">可选的错误详情或数据。</param>
		/// <returns>ApiResponse 实例。</returns>
		public static ApiResponse Error(string message = "操作失败。", object? result = null)
		{
			return new ApiResponse(false, message, result);
		}

		public ApiResponse()
		{
		}

		private ApiResponse(bool status, string message, object? result)
		{
			Status = status;
			Message = message;
			Result = result;
		}

		public string Message { get; set; }

		public bool Status { get; set; }

		public object Result { get; set; }
	}
}
