#if !WebManagement
using GameData.Club;
#endif
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GameData;

namespace ObjectModel.Club
{
    /// <summary>
    /// 玩家联赛权限
    /// </summary>
    public class ClubLeaguePower
    {
        /// <summary>
        /// 自增Id 主键
        /// </summary>
        public int ClubLeaguePowerId;
        /// <summary>
        /// 俱乐部Id  --索引
        /// </summary>
        public int ClubId;
        /// <summary>
        /// 是否有创建联赛权限  Ture有权限 false 没有
        /// </summary>
        public bool IsCanCreate;
        /// <summary>
        /// 是否有加入联赛权限  Ture有权限 false 没有
        /// </summary>
        public bool IsCanJoin;
    }

    /// <summary>
    /// 加入到联赛的俱乐部集合
    /// </summary>
    public class JoinInClubLeagueMatch
    {
        /// <summary>
        /// 比赛Id--索引
        /// </summary>
        public int ClubMatchId;

        /// <summary>
        /// 存数据库 Json 数据
        /// </summary>
        public string JoinInLeagueMatchClubs;

        /// <summary>
        /// 加入联赛的俱乐部Id集合,保存前到联赛内存里面拿数据。中途对该对象不做操作
        /// </summary>
        public List<int> ClubIds;

        /// <summary>
        /// 返回存数据库的JSon 字符串,存数据库前调用
        /// </summary>
        /// <returns></returns>
        public string GetJoinInLeagueMatchClubsToString()
        {
            return JsonPack.GetJson(ClubIds);
        }

        /// <summary>
        /// 从Json字符串获取加入的俱乐部Id集合对象  ，从数据库取出后调用
        /// </summary>
        /// <returns></returns>
        public List<int> GetClubIdsByJSON()
        {
            return string.IsNullOrWhiteSpace(JoinInLeagueMatchClubs) ? null : JsonPack.GetData<List<int>>(JoinInLeagueMatchClubs);
        }
    }

    /// <summary>
    /// 联赛禁桌对象。
    /// </summary>
    public class LeagueMatchBanDesk
    {
        /// <summary>
        /// 自增Id 主键
        /// </summary>
        public int LeagueMatchBanDeskId;

        /// <summary>
        /// 玩法ID
        /// </summary>
        public string WayId;

        /// <summary>
        /// 存数据库 Json 数据
        /// </summary>
        public string JSONString;

        /// <summary>
        /// 被禁桌的俱乐部集合
        /// </summary>
        public List<int> ClubIds;

        /// <summary>
        /// 返回存数据库的JSon 字符串,存数据库前调用
        /// </summary>
        /// <returns></returns>
        public string GetClubsToString()
        {
            return JsonPack.GetJson(ClubIds);
        }

        /// <summary>
        /// 从Json字符串获取加入的俱乐部Id集合对象  ，从数据库取出后调用
        /// </summary>
        /// <returns></returns>
        public List<int> GetClubIdsByJSON()
        {
            return string.IsNullOrWhiteSpace(JSONString) ? null : JsonPack.GetData<List<int>>(JSONString);
        }
    }

    /// <summary>
    /// 联赛俱乐部积分统计
    /// </summary>
    public class LeagueMatchClubScore : ClubLeagueBaseScoreInfo,ICloneable
    {
        /// <summary>
        /// 联赛俱乐部ID
        /// </summary>
        public int LeagueClubId { get; set; }
        
        /// <summary>
        /// 联盟比赛的Id
        /// </summary>
        public int MatchId { get; set; }
        
        /// <summary>
        /// 自增Id 主键 (Old)
        /// </summary>
        public int LeagueMatchClubScoreId;

        /// <summary>
        /// 数据更新时间
        /// </summary>
        public DateTime UpdateTime { get; set; }

        public object Clone()
        {
            return this.MemberwiseClone();
        }
    }

    /// <summary>
    /// 俱乐部退赛数据
    /// </summary>
    public class LeagueMatchClubExitScore : LeagueMatchClubScore
    {
        /// <summary>
        /// 俱乐部解禁Id （时间戳 秒级）
        /// </summary>
        public long ReliefId { get; set; }

        /// <summary>
        /// 颁奖Id
        /// </summary>
        public long AwardId { get; set;}
    }

    /// <summary>
    /// 颁奖记录
    /// </summary>
    public class AwardRecord : ClubLeagueBaseScoreInfo
    {
        /// <summary>
        /// 比赛Id--索引
        /// </summary>
        public int ClubMatchId { get; set; }
        
        /// <summary>
        /// 自增Id 主键
        /// </summary>
        //public int AwardRecordId;

        /// <summary>
        /// 颁奖的时间chuo
        /// </summary>
        public long RecordId { get; set;}
        
        /// <summary>
        /// 序号 --排序使用
        /// </summary>
        public int Index { get; set; }
        
        /// <summary>
        /// 时间
        /// </summary>
        public DateTime CreateTime { get; set; }
    }

    public class ClubLeagueBaseScoreInfo
    {
        /// <summary>
        /// 俱乐部名字
        /// </summary>
        public string ClubName { get; set; }

        /// <summary>
        /// 俱乐部Id
        /// </summary>
        public int ClubId { get; set; }

        /// <summary>
        /// 有效耗卡
        /// </summary>
        public decimal CardScore { get; set; }

        /// <summary>
        /// 活跃积分-群主赚的房费
        /// </summary>
        public decimal DeskScore { get; set; }

        /// <summary>
        /// 成员总积分
        /// </summary>
        public decimal ClubUserSumScore { get; set; }

        /// <summary>
        /// 参与房间数量
        /// </summary>
        public int JoinRoom { get; set; }

        /// <summary>
        /// 联盟的活跃积分
        /// </summary>
        public decimal LeagueScore { get; set; }
    }

    /// <summary>
    /// 俱乐部生存任务
    /// </summary>
    public class LeagueClubLiveTask
    {
        /// <summary>
        /// 自增Id 主键
        /// </summary>
        public int LeagueClubLiveTaskId;

        /// <summary>
        /// 俱乐部Id
        /// </summary>
        public int ClubId;

        /// <summary>
        /// 任务的分值 0是不限制
        /// </summary>
        public int TaskScore;

        /// <summary>
        /// 是否是激活状态 false没有生效
        /// </summary>
        public bool IsActive
        {
            get
            {
                return TaskScore != 0;
            }
        }

        /// <summary>
        /// 默认生存积分 0是没有默认积分
        /// </summary>
        public int DefaultScore;
    }
}
