using System;
using System.Collections.Generic;
using MessagePack;

#if GameClient
using GameFramework;
#endif

namespace GameMessage
{
    /// <summary>
    /// 联赛颁奖请求
    /// </summary>
    [Message(MessageCode.LeagueAwardRequest)]
    [MessagePackObject]
    public class LeagueAwardRequest : MessageData
    {
        [Key(0)] public int ClubId;

        [Key(1)] public bool IsNewTask;

#if GameClient
        public static LeagueAwardRequest Create(int clubId, bool isNewTask)
        {
            LeagueAwardRequest request = ReferencePool.Acquire<LeagueAwardRequest>();
            request.ClubId = clubId;
            request.IsNewTask = isNewTask;
            return request;
        }
#endif
    }

    /// <summary>
    /// 联赛颁奖应答
    /// </summary>
    [Message(MessageCode.LeagueAwardResponse)]
    [MessagePackObject]
    public class LeagueAwardResponse : MessageData
    {
        [Key(0)] public int ClubId;

        [Key(1)] public string ErrMessage;
    }
    
    /// <summary>
    /// 颁奖记录信息请求
    /// </summary>
    [Message(MessageCode.ClubMatchAwardLogRequest)]
    [MessagePackObject]
    public class ClubMatchAwardLogRequest : MessageData
    {
        /// <summary>
        /// 俱乐部ID
        /// </summary>
        [Key(0)] public int ClubId;

        /// <summary>
        /// 比赛Id
        /// </summary>
        [Key(1)] public int ClubMatchId;
        
#if GameClient
        public static ClubMatchAwardLogRequest Create(int clubId, int clubMatchId)
        {
            ClubMatchAwardLogRequest request = ReferencePool.Acquire<ClubMatchAwardLogRequest>();
            request.ClubId = clubId;
            request.ClubMatchId = clubMatchId;
            return request;
        }
#endif
    }

    /// <summary>
    /// 颁奖记录信息响应
    /// </summary>
    [Message(MessageCode.ClubMatchAwardLogResponse)]
    [MessagePackObject]
    public class ClubMatchAwardLogResponse : MessageData
    {
        /// <summary>
        /// 俱乐部ID
        /// </summary>
        [Key(0)] public int ClubId;

        /// <summary>
        /// 比赛Id
        /// </summary>
        [Key(1)] public int ClubMatchId;

        /// <summary>
        /// 内容
        /// </summary>
        [Key(2)]
        public Dictionary<long, ClubMatchAwardLogInfo> Dict;
    }
    
    /// <summary>
    /// 颁奖记录详情信息请求
    /// </summary>
    [Message(MessageCode.ClubMatchAwardDetailLogRequest)]
    [MessagePackObject]
    public class ClubMatchAwardDetailLogRequest : MessageData
    {
        /// <summary>
        /// 俱乐部ID
        /// </summary>
        [Key(0)] public int ClubId;

        /// <summary>
        /// 颁奖纪录Id ()
        /// </summary>
        [Key(1)] public int AwardRecordId;
        
#if GameClient
        public static ClubMatchAwardDetailLogRequest Create(int clubId, int awardRecordId)
        {
            ClubMatchAwardDetailLogRequest request = ReferencePool.Acquire<ClubMatchAwardDetailLogRequest>();
            request.ClubId = clubId;
            request.AwardRecordId = awardRecordId;
            return request;
        }
#endif
    }

    /// <summary>
    /// 颁奖记录信息响应
    /// </summary>
    [Message(MessageCode.ClubMatchAwardDetailLogResponse)]
    [MessagePackObject]
    public class ClubMatchAwardDetailLogResponse : MessageData
    {
        /// <summary>
        /// 俱乐部ID
        /// </summary>
        [Key(0)] public int ClubId;

        /// <summary>
        /// 比赛Id
        /// </summary>
        [Key(1)] public int ClubMatchId;

        /// <summary>
        /// 内容
        /// </summary>
        [Key(2)]
        public Dictionary<long, ClubMatchAwardLogInfo> Dict;
    }

    [MessagePackObject]
    public class ClubMatchAwardLogInfo
    {
        /// <summary>
        /// 颁奖时间
        /// </summary>
        [Key(0)] public DateTime Time;
        
        /// <summary>
        /// 颁奖ID
        /// </summary>
        [Key(1)] public long AwardId;
        
        /// <summary>
        /// 排行记录
        /// </summary>
        [Key(2)] public List<ClubMessageRankInfo> RankInfo;
        
        /// <summary>
        /// 统计数据
        /// </summary>
        [Key(3)] public LeagueClubStatisticsData Statistics;
    }
}