using System.Collections.Generic;
using MessagePack;
#if Server
using Server.Core;
#else
using GameFramework;
#endif

namespace GameMessage
{
    [Message(MessageCode.ClubMatchListRequest)]
    [MessagePackObject]
    public class ClubMatchListRequest : MessageData
    {
        [Key(0)]
        public int ClubId;
        
        #if GameClient
        public static ClubMatchListRequest Create(int clubId)
        {
            var request = ReferencePool.Acquire<ClubMatchListRequest>();
            request.ClubId = clubId;
            return request;
        }
        #endif
    }

    [Message(MessageCode.ClubMatchListResponse)]
    [MessagePackObject]
    public class ClubMatchListResponse : MessageData
    {
        [Key(0)]
        public int ResultCode;
        
        [Key(1)]
        public int ClubId;
        
        /// <summary>
        /// 俱乐部比赛列表
        /// </summary>
        [Key(2)]
        public List<ClubMatchData> MatchInfos;
        
        #if Server
        public static ClubMatchListResponse Create(int clubId)
        {
            var response = ReferencePool.Fetch<ClubMatchListResponse>();
            response.ClubId = clubId;
            return response;
        }

        public override void Dispose()
        {
            MatchInfos = null;
            ReferencePool.Recycle(this);
        }
#endif
    }
    
    [MessagePackObject]
    public class ClubMatchData
    {
        /// <summary>
        /// 比赛Id，关于比赛的参数用这个跟服务器交互
        /// </summary>
        [Key(0)]
        public int ClubMatchId;

        /// <summary>
        /// 俱乐部Id
        /// </summary>
        [Key(1)]
        public int ClubId;

        /// <summary>
        /// 比赛名字
        /// </summary>
        [Key(2)]
        public string ClubMatchName;

        /// <summary>
        /// 比赛开始时间-
        /// </summary>
        [Key(3)]
        public long MatchStartTime;

        /// <summary>
        /// 比赛结束时间
        /// </summary>
        [Key(4)]
        public long MatchEndTime;

        /// <summary>
        /// 比赛状态1进行中  2比赛结束
        /// </summary>
        [Key(5)]
        public int StatusFlag;
    }
}