using MessagePack;

namespace CrazyStudio.Core.Common.Redis.Dto
{
    /// <summary>
    /// 基础消息类型
    /// </summary>
    [MessagePackObject]
    public struct BaseMessage
    {
        /// <summary>
        /// 消息类型
        /// </summary>
        [Key("msgType")]
        public ushort MsgType { get; set; }

        /// <summary>
        /// 消息发送者ID，一个消息发送者ID可能有多个用户连接ID，全局唯一
        /// </summary>
        [Key("senderId")]
        public string SenderId { get; set; } = string.Empty;
        /// <summary>
        /// 用户连接ID，可能一个用户对应多个用户连接ID，全局唯一
        /// </summary>
        [Key("connectionId")]
        public string ConnectionId { get; set; } = string.Empty;
        /// <summary>
        /// 房间ID，一个房间内可以有多个用户，全局唯一
        /// </summary>
        [Key("receiverOrRoomId")]
        public string ReceiverOrRoomId { get; set; } = string.Empty;
        /// <summary>
        /// 消息内容
        /// </summary>
        [Key("msgContent")]
        public byte[]? MsgContent { get; set; } = default;
        public BaseMessage()
        {

        }
    }
}
