using System.Collections.Generic;
using Server.Core;

namespace ObjectModel.Club
{
    /// <summary>
    /// 俱乐部玩家结算详情
    /// </summary>
    public class ClubPlayerSettleDetail : Reference
    {
        /// <summary>
        /// 大赢家列表
        /// </summary>
        public List<int> BigWinIndexs;

        /// <summary>
        /// 大赢家用户列表
        /// </summary>
        public List<int> BigWinUserIds;
        
        /// <summary>
        /// 牌局最大分数
        /// </summary>
        public decimal MaxScore;
        
        /// <summary>
        /// 房主用户Id
        /// </summary>
        public int RoomOwnerUserId;
        
        /// <summary>
        /// 房卡数量
        /// </summary>
        public int CardNum;
        
        public static ClubPlayerSettleDetail Create()
        {
            var entity = ReferencePool.Fetch<ClubPlayerSettleDetail>();
            entity.BigWinIndexs = new List<int>();
            entity.BigWinUserIds = new List<int>();
            entity.MaxScore = -1;
            entity.RoomOwnerUserId = -1;
            entity.CardNum = 0;
            return entity;
        }
        
        /// <summary>
        /// 是否大赢家
        /// </summary>
        public bool IsBigWinByIndex(int index)
        {
            return BigWinIndexs.Contains(index);
        }
        
        public bool IsBigWinByUserId(int userId)
        {
            return BigWinUserIds.Contains(userId);
        }
        
        /// <summary>
        /// 是否房主
        /// </summary>
        public bool IsRoomOwner(int userId)
        {
            return RoomOwnerUserId == userId;
        }

        public override void Dispose()
        {
            BigWinIndexs.Clear();
            BigWinUserIds.Clear();
            
            ReferencePool.Recycle(this);
        }
    }
}