using System.Collections.Generic;
using System.Linq;
using GameMessage;

namespace GameFix.Poker
{
    public class CardStyle5Helper : CardStyleBaseHelper
    {
        public override int CardStyle => DataCardConst.CardStyle5;
        public override int CardCnt => 2;
        
        internal override bool CheckStyleNormal(CardBaseGroup group, out CardStyleInfo cardStyleInfo)
        {
            cardStyleInfo = null;
            if (group.Cards.Count == CardCnt 
                && group.Cards.Count(x=>DataCardConst.JokerValues.Contains(x.Value)) == CardCnt
                && group.Cards[0].Value != group.Cards[1].Value)
            {
                cardStyleInfo = CardStyleHelper.CreateCardStyleInfo(CardStyle, group.Cards);
                return true;
            }
            
            return false;
        }

        internal override bool CheckStyleWithLZ(CardBaseGroup group, out CardStyleInfo cardStyleInfo)
        {
            cardStyleInfo = null;
            return false;
        }

        internal override List<CardGroupList> GetAllEatTipGroup(CardBaseGroup group, CardStyleInfo eatStyleInfo)
        {
            var groupList = new List<CardGroupList>(1);
            if (group.CardGroupList[18].Count>0 && group.CardGroupList[19].Count>0)
            {
                var cardGroup = new CardGroupList();
                cardGroup.AddRange(group.CardGroupList[18]);
                cardGroup.AddRange(group.CardGroupList[19]);
                groupList.Add(cardGroup);
            }

            return groupList;
        }

        internal override List<CardGroupList> GetAllEatTipGroupWithLZ(CardBaseGroup group, CardStyleInfo eatStyleInfo)
        {
            return new List<CardGroupList>(0);
        }
    }
}