using System.Collections.Generic;

namespace Wizard;

public class AIDeckData
{
	private Dictionary<int, AICardData> cardDic;

	public Dictionary<int, AICardData> CardDic => cardDic;

	public AIDeckData()
	{
		cardDic = new Dictionary<int, AICardData>();
	}

	public void Clear()
	{
		cardDic.Clear();
	}

	public bool RegisterCardData(AICardDataAsset asset, AICardData mergeData = null, bool isMergeDefaultParameter = false)
	{
		if (cardDic.ContainsKey(asset.CardID))
		{
			return false;
		}
		AICardData aICardData = new AICardData(asset);
		if (mergeData != null)
		{
			if (isMergeDefaultParameter)
			{
				aICardData.MergeCardData(mergeData);
			}
			else
			{
				aICardData.MergeTagFromAnotherData(mergeData);
			}
		}
		cardDic.Add(asset.CardID, aICardData);
		return true;
	}

	public AICardData SearchCardData(int card_id)
	{
		AICardData value = null;
		if (CardDic.TryGetValue(card_id, out value))
		{
			return value;
		}
		return null;
	}
}
