using System.Collections.Generic;
using MessagePack;
#if GameClient
using GameFramework;
#endif

namespace GameMessage
{
    [Message(MessageCode.ClubMsgRequest)]
    [MessagePackObject]
    public class ClubMsgRequest : MessageData
    {
        /// <summary>
        /// 俱乐部Id
        /// </summary>
        [Key(0)]
        public int ClubId;

        /// <summary>
        /// 消息版本
        /// </summary>
        [Key(1)]
        public ulong MsgVer;

#if GameClient
        public static ClubMsgRequest Create(int clubId,ulong msgVer)
        {
            ClubMsgRequest request = ReferencePool.Acquire<ClubMsgRequest>();
            request.ClubId = clubId;
            request.MsgVer = msgVer;
            return request;
        }
#endif
    }

    [Message(MessageCode.ClubMsgResponse)]
    [MessagePackObject]
    public class ClubMsgResponse : MessageData
    {
        /// <summary>
        /// 俱乐部Id
        /// </summary>
        [Key(0)]
        public int ClubId;

        /// <summary>
        /// 消息版本
        /// </summary>
        [Key(1)]
        public ulong MsgVer;

        /// <summary>
        /// 消息
        /// </summary>
        [Key(2)]
        public List<ClubMsg> Msgs;
    }

    [MessagePackObject]
    public class ClubMsg
    {
        /// <summary>
        /// 消息ID
        /// </summary>
        [Key(0)]
        public int Id;

        /// <summary>
        /// 消息类型
        /// </summary>
        [Key(1)]
        public int Style;

        /// <summary>
        /// 消息状态
        /// </summary>
        [Key(2)]
        public int State;

        /// <summary>
        /// 发送时间
        /// </summary>
        [Key(3)]
        public long SendTime;

        /// <summary>
        /// 处理时间
        /// </summary>
        [Key(4)]
        public long DoTime;

        /// <summary>
        /// 处理人Id
        /// </summary>
        [Key(5)]
        public int DoUserId;

        /// <summary>
        /// 处理人名称
        /// </summary>
        [Key(6)]
        public string DoManNickName;

        /// <summary>
        /// 接收的俱乐部Id
        /// </summary>
        [Key(7)]
        public int ReceiveId;

        /// <summary>
        /// 发送者UserId
        /// </summary>
        [Key(8)]
        public int SendId;

        /// <summary>
        /// 发送者的名称
        /// </summary>
        [Key(9)]
        public string SendNickName;

        /// <summary>
        /// 消息内容
        /// </summary>
        [Key(10)]
        public string Content;

        /// <summary>
        /// 发送者的性别
        /// </summary>
        [Key(11)]
        public int SendSex;

        /// <summary>
        /// 扩展参数1
        /// </summary>
        [Key(12)]
        public int Param1;

        /// <summary>
        /// 扩展参数2
        /// </summary>
        [Key(13)]
        public string Param2;

        [IgnoreMember]
        public bool IsPartnerMessage
        {
            get
            {
                return Param1 > 0;
            }
        }
    }
}