namespace DataSharing.Share.Dtos.Province
{
    public class ProvinceResponse
    {
        public BaseProvinceResponse ReturnInfo { get; set; }

        [System.Text.Json.Serialization.JsonPropertyName("status")]
        public ProvinceStatusBathResponse Status {  get; set; }

        [System.Text.Json.Serialization.JsonPropertyName("custom")]
        public ProvinceBathCustomResponse Custom { get; set; }
    }

    public class ProvinceStatusBathResponse
    {
        [System.Text.Json.Serialization.JsonPropertyName("code")]
        public string Code { get; set; }

        [System.Text.Json.Serialization.JsonPropertyName("text")]
        public string Text { get; set; }
    }

    public class ProvinceBathCustomResponse
    {
        [System.Text.Json.Serialization.JsonPropertyName("errorObjs")]
        public List<ProvinceBathErrorObjsResponse> ErrorObjs {  get; set; }

        [System.Text.Json.Serialization.JsonPropertyName("successCount")]
        public int SuccessCount {  get; set; }

        [System.Text.Json.Serialization.JsonPropertyName("totalCount")]
        public int TotalCount {  get; set; }
    }

    public class ProvinceBathErrorObjsResponse
    {
        [System.Text.Json.Serialization.JsonPropertyName("resturl")]
        public string RestUrl {  get; set; }

        [System.Text.Json.Serialization.JsonPropertyName("datasource")]
        public string DataSource { get; set; }

        [System.Text.Json.Serialization.JsonPropertyName("caseserial")]
        public string CaseSerial { get; set; }

        [System.Text.Json.Serialization.JsonPropertyName("caseid")]
        public string CaseId { get; set; }

        [System.Text.Json.Serialization.JsonPropertyName("dataobj")]
        public string DataObj { get; set; }

        [System.Text.Json.Serialization.JsonPropertyName("errormsg")]
        public string ErrorMsg { get; set; }
    }

    /// <summary>
    /// 省接口返回
    /// </summary>
    public class BaseProvinceResponse
    {
        public string Code { get; set; }

        public string Description { get; set; }
    }


    /// <summary>
    /// 省接口调用返回数据
    /// </summary>
    public class Reponse
    {
        [System.Text.Json.Serialization.JsonPropertyName("ReturnInfo")]
        public ReponseBase ReturnInfo { get; set; }

        public static Reponse Success(string? description = "")
        {
            return new Reponse
            {
                ReturnInfo = new ReponseBase
                {
                    Code = "1",
                    Description = (description ?? "您已成功提交数据！")
                }
            };
        }

        public static Reponse Failed(string? description = "")
        {
            return new Reponse
            {
                ReturnInfo = new ReponseBase
                {
                    Code = "0",
                    Description = (description ?? "接口调用失败！")
                }
            };
        }
    }

    /// <summary>
    /// 省调用接口返回状态
    /// </summary>
    public class ReponseBase
    {
        [System.Text.Json.Serialization.JsonPropertyName("Code")]
        public string Code { get; set; }

        [System.Text.Json.Serialization.JsonPropertyName("Description")]
        public string Description { get; set; }
    }
}
