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

namespace GameMessage
{
    /// <summary>
    /// 联赛的俱乐部信息请求
    /// </summary>
    [Message(MessageCode.LeagueClubsInfoRequest)]
    [MessagePackObject]
    public class LeagueClubsInfoRequest : MessageData
    {
        [Key(0)] public int ClubId;
        /// <summary>
        /// 获取简单得俱乐部信息
        /// </summary>
        [Key(1)] public bool IsSampleInfo;
        /// <summary>
        /// 仅获取成员 （默认会带上联盟长信息） 
        /// </summary>
        [Key(2)] public bool IsOnlyMember;

#if GameClient
        public static LeagueClubsInfoRequest Create(int clubId, bool isSampleInfo, bool isOnlyMember)
        {
            LeagueClubsInfoRequest request = ReferencePool.Acquire<LeagueClubsInfoRequest>();
            request.ClubId = clubId;
            request.IsSampleInfo = isSampleInfo;
            request.IsOnlyMember = isOnlyMember;
            return request;
        }
#endif
    }

    /// <summary>
    /// 联赛的俱乐部信息响应
    /// </summary>
    [Message(MessageCode.LeagueClubsInfoResponse)]
    [MessagePackObject]
    public class LeagueClubsInfoResponse : MessageData
    {
        /// <summary>
        /// 俱乐部ID
        /// </summary>
        [Key(0)] public int ClubId;

        /// <summary>
        /// 错误信息
        /// </summary>
        [Key(1)] public string ErrMessage;

        [Key(2)] public List<JoinLeagueClubInfo> Datas;
    }

    [MessagePackObject]
    public class JoinLeagueClubInfo
    {
        [Key(0)] public string ClubName;

        [Key(1)] public int ClubId;

        [Key(2)] public string ClubLeaderName;

        /// <summary>
        /// 俱乐总人数
        /// </summary>
        [Key(3)] public int Count;

        /// <summary>
        /// 1联赛创始人  2联赛成员 3联赛管理员
        /// </summary>
        [Key(4)] public int PlayType;

        /// <summary>
        /// 是否禁止 true是 false不是
        /// </summary>
        [Key(5)] public bool IsBan;

        /// <summary>
        /// 是否被淘汰 true是 false不是
        /// </summary>
        [Key(6)] public bool IsWeedOut;

        /// <summary>
        /// 俱乐部的最终积分
        /// </summary>
        [Key(7)] public decimal FinallScore;

        /// <summary>
        /// 俱乐部的生存积分
        /// </summary>
        [Key(8)] public int LifeTaskScore;
    }
}