#if GameClient
using GameFramework;
#endif

using MessagePack;

namespace GameMessage
{
    /// <summary>
    /// 获取账号信息
    /// </summary>
    [Message(MessageCode.GetAccountInfoRequest)]
    [MessagePackObject]
    public class GetAccountInfoRequest : MessageData
    {
        /// <summary>
        /// 手机号
        /// </summary>
        [Key(0)] public string PhoneNum;

        /// <summary>
        /// 验证码
        /// </summary>
        [Key(1)] public string VerifyCode;

#if GameClient
        public static GetAccountInfoRequest Create(string phoneNum, string verifyCode)
        {
            GetAccountInfoRequest self = ReferencePool.Acquire<GetAccountInfoRequest>();
            self.PhoneNum = phoneNum;
            self.VerifyCode = verifyCode;
            return self;
        }

        public override void Clear()
        {
            PhoneNum = null;
            VerifyCode = null;
        }
#endif
    }

    [Message(MessageCode.GetAccountInfoResponse)]
    [MessagePackObject]
    public class GetAccountInfoResponse : MessageData
    {
        /// <summary>
        /// 结果
        /// </summary>
        [Key(0)] public int ResultCode;

        /// <summary>
        /// 用户的UserId
        /// </summary>
        [Key(1)] public int UserId;

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

        /// <summary>
        /// 用户名
        /// </summary>
        [Key(3)] public string UserName;

        /// <summary>
        /// 重置密码Token
        /// </summary>
        [Key(4)] public string ResetToken;
    }

    /// <summary>
    /// 重置密码请求
    /// </summary>
    [Message(MessageCode.ResetPasswordRequest)]
    [MessagePackObject]
    public class ResetPasswordRequest : MessageData
    {
        /// <summary>
        /// 玩家的UserId
        /// </summary>
        [Key(0)] public int UserId;

        /// <summary>
        /// 重置的Token
        /// </summary>
        [Key(1)] public string ResetToken;

        /// <summary>
        /// 新的密码
        /// </summary>
        [Key(2)] public string NewPassword;

#if GameClient
        public static ResetPasswordRequest Create(int userId, string resetToken, string newPassword)
        {
            ResetPasswordRequest request = ReferencePool.Acquire<ResetPasswordRequest>();
            request.UserId = userId;
            request.ResetToken = resetToken;
            request.NewPassword = newPassword;
            return request;
        }

        public override void Clear()
        {
            ResetToken = null;
            NewPassword = null;
        }
#endif
    }

    /// <summary>
    /// 重置密码响应
    /// </summary>
    [Message(MessageCode.ResetPasswordResponse)]
    [MessagePackObject]
    public class ResetPasswordResponse : MessageData
    {
        /// <summary>
        /// 重置结果
        /// </summary>
        [Key(0)] public int ResultCode;
    }
}