using System.Text.Json.Serialization;

namespace WorkFlowCheck.Common.DTO
{
    public class ApiResponseBaseDTO
    {
        public ApiResponseBaseDTO()
        {
            Errors = new List<string>();
        }
        public bool IsSuccess { get; set; }
        public List<string> Errors { get; set; }
        public bool HandleError { get; set; }
        public string Error
        {
            get
            {
                if (Errors == null || Errors.Count() == 0) return string.Empty;
                return string.Join(';', Errors);
            }
        }
    }

    public class ApiResponseDTO : ApiResponseBaseDTO
    {
        public object Data { get; set; }
    }

    public interface IApiResponseDTO<out T>
    {

    }

    public class ApiResponseDTO<T> : ApiResponseBaseDTO, IApiResponseDTO<T>
    {
        public T Data { get; set; }
    }
    public class ApiResponseListDTO<T> : ApiResponseBaseDTO
    {
        public T[] Data { get; set; }
        public int Total { get; set; }
    }
}
