namespace DataSharing.Share.Dtos.Police110.DaoShu110
{
    public class DaoShuDeResponse<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 DaoShuDeResponse<TData> Succeed(TData data, string? description = "调用成功")
        {
            return new DaoShuDeResponse<TData>
            {
                rdata = data,
                rcode = 0,
                rmsg = description ?? "调用成功"
            };
        }

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