using DataSharing.Share.Dtos.Police110.DaoShu110;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataSharing.Share.Dtos.Police110.HaiNengDa110
{
    public class HaiNengDaDeResponse<TData>
    {
        /// <summary>
        /// 状态
        /// </summary>
        public int code { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        public string msg { get; set; }

        /// <summary>
        /// 数据
        /// </summary>
        public TData data { get; set; }

        /// <summary>
        /// 成功
        /// </summary>
        /// <param name="data"></param>
        /// <param name="description"></param>
        /// <returns></returns>
        public static HaiNengDaDeResponse<TData> Succeed(TData data, string? description = "调用成功")
        {
            return new HaiNengDaDeResponse<TData>
            {
                data = data,
                code = 0,
                msg = description ?? "调用成功"
            };
        }

        /// <summary>
        /// 失败
        /// </summary>
        /// <param name="data"></param>
        /// <param name="description"></param>
        /// <returns></returns>
        public static HaiNengDaDeResponse<TData> Failed(TData data, string? description = "调用失败")
        {
            return new HaiNengDaDeResponse<TData>
            {
                data = data,
                code = -1,
                msg = description ?? "调用失败"
            };
        }
    }
}
