using Newtonsoft.Json;

namespace SGModule.Net {
    public class ResponseData<T> {
        [JsonProperty("code")] public int Code;
        [JsonProperty("data")] public T Data;
        [JsonProperty("msg")] public string Msg;

        public bool IsSuccess => Code == 0;

        public void Deconstruct(out bool isSuccess, out T data) {
            isSuccess = IsSuccess;
            data = Data;
        }
    }

    public class RequestTokenData {
        [JsonProperty("expires_at")] public long ExpiresAt;
        [JsonProperty("token")] public string Token;
    }
}
