using DataSharing.Share.Dtos.Police110.DaoShu110;

namespace DataSharing.Share.Dtos.Police110.DCJT110
{
    public class DCJTDeResponse<TData>
    {
        /// <summary>
        /// 状态
        /// </summary>
        public int rcode { get; set; }

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

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

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

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