using DataSharing.Share.Dtos.FwDataExchange;

namespace DataSharing.Share.Dtos
{
    /// <summary>
    /// 目前已对接返回值
    /// </summary>
    public class GetDataBaseReponse<TData>
    {
        [System.Text.Json.Serialization.JsonPropertyName("code")]
        public int Code { get; set; }

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

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

        /// <summary>
        /// 成功
        /// </summary>
        /// <param name="data"></param>
        /// <param name="description"></param>
        /// <returns></returns>
        public static GetDataBaseReponse<TData> Success(TData data, string? description = "")
        {
            return new GetDataBaseReponse<TData>
            {
                Code = 1,
                data = data,
                Message = (description ?? "请求成功！")
            };
        }

        /// <summary>
        /// 失败
        /// </summary>
        /// <param name="description"></param>
        /// <returns></returns>
        public static GetDataBaseReponse<TData> Failed(string? description = "")
        {
            return new GetDataBaseReponse<TData>
            {
                Code = 0,
                Message = (description ?? "请求失败！")
            };
        }

    }

    public class GetFwyToken
    {
        public int code { get; set; }

        public string msg { get; set; }

        public GetFwyTokenInfo data { get; set; }
    }

    public class GetFwyTokenInfo
    {
        /// <summary>
        /// Token
        /// </summary>
        public string token { get; set; }

        /// <summary>
        /// 有效期（秒）
        /// </summary>
        public int expiresIn { get; set; }
    }
}
