namespace DataSharing.Share.Dtos.YiBin.ZzptPlatformsYB
{
    public class OtherPlatformsDeResponse<TData>
    {
        /// <summary>
        /// 状态
        /// </summary>
        public string code { get; set; }

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

        /// <summary>
        /// 成功
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static OtherPlatformsDeResponse<TData> Success(TData data)
        {
            return new OtherPlatformsDeResponse<TData>
            {
                code = "1",
                msg = data
            };
        }

        /// <summary>
        /// 失败
        /// </summary>
        /// <param name="data"></param>
        /// <param name="code"></param>
        /// <returns></returns>
        public static OtherPlatformsDeResponse<TData> Failed(TData data, string? code = "0")
        {
            return new OtherPlatformsDeResponse<TData>
            {
                code = code,
                msg = data
            };
        }
    }
}
