#if GameClient
using GameFramework;
#endif
using GameMessage;
using MessagePack;
#if Server
using Server.Core;
#endif
namespace UnityGame
{
    [Message(MessageCode.XiaoMiLoginVerificationRequest)]
    [MessagePackObject]
    public class XiaoMiLoginVerificationRequest : MessageData
    {
        /// <summary>
        /// 小米用户UID
        /// </summary>
        [Key(0)] public string Uid;

        /// <summary>
        /// 小米用户Session
        /// </summary>
        [Key(1)] public string Session;

        /// <summary>
        /// 昵称
        /// </summary>
        [Key(2)] public string NickName;

#if GameClient
        public static XiaoMiLoginVerificationRequest Create(string uid,string session,string nickName)
        {
            XiaoMiLoginVerificationRequest self = ReferencePool.Acquire<XiaoMiLoginVerificationRequest>();
            self.Uid = uid;
            self.Session = session;
            self.NickName = nickName;
            return self;
        }

        public override void Clear()
        {
            Uid = null;
            Session = null;
        }
#endif
    }

    [Message(MessageCode.XiaoMiLoginVerificationResponse)]
    [MessagePackObject]
    public class XiaoMiLoginVerificationResponse : MessageData
    {
        [Key(0)]
        public int ResultCode;
        
        /// <summary>
        ///状态码:
        /// 200 验证正确
        /// 1515 appId 错误(注意格式问题:比如appId必须是数字以及是否没传)
        /// 1516 uid 错误
        /// 1520 session 错误
        /// 1525 signature 错误
        /// 4002 appid, uid, session 不匹配(常见为session过期)
        /// </summary>
        [Key(1)] public int ErrCode;

        /// <summary>
        /// 错误信息
        /// </summary>
        [Key(2)] public string ErrMsg;

        /// <summary>
        /// 用户实名标识:
        /// 406 非身份证实名方式 (建议当做已实名成年用户处理)
        /// 407 实名认证通过，年龄大于18岁
        /// 408 实名认证通过，年龄小于18岁
        /// 409 未进行实名认证 |age|可选|用户年龄
        /// </summary>
        [Key(3)] public int Adult;

        /// <summary>
        /// 用户年龄
        /// </summary>
        [Key(4)] public int Age;

        /// <summary>
        /// 用户Uid
        /// </summary>
        [Key(5)] public string Uid;

        /// <summary>
        /// 昵称
        /// </summary>
        [Key(6)] public string NikeName;

#if Server
        public static XiaoMiLoginVerificationResponse Create()
        {
            XiaoMiLoginVerificationResponse self = ReferencePool.Fetch<XiaoMiLoginVerificationResponse>();
            return self;
        }

        public override void Dispose()
        {
            base.Dispose();
        }
#endif
    }
}