using System.Collections.Generic;

namespace Wizard;

public class CardSetNameMgr
{
	public const int BASIC_CARD_SET_ID = 10000;

	private const int MIN_STANDARD_PACK_ID = 10001;

	private const int MAX_STANDARD_PACK_ID = 14999;

	private const int MIN_COLLABO_PACK_ID = 20001;

	private const int MAX_COLLABO_PACK_ID = 24999;

	private const int TOKEN_CARD_SET_ID = 90000;

	public const int SPECIAL_CARD_PACK_ID = 90002;

	private const int MIN_PRIZE_SET_ID = 70000;

	private const int MAX_PRIZE_SET_ID = 79999;

	private List<CardSetName> _list = new List<CardSetName>();

	private List<CardSetName> _listBasicAndPack;

	public static bool IsPrizeSetId(int setId)
	{
		if (70000 <= setId)
		{
			return setId <= 79999;
		}
		return false;
	}

	public static bool IsBasicSetId(int setId)
	{
		return setId == 10000;
	}

	public static bool IsStandardPackSetId(int setId)
	{
		if (10001 <= setId)
		{
			return setId <= 14999;
		}
		return false;
	}

	public static bool IsTokenSetId(int setId)
	{
		return setId == 90000;
	}

	public static bool IsCollaboSetId(int setId)
	{
		if (20001 <= setId)
		{
			return setId <= 24999;
		}
		return false;
	}

	public void Add(CardSetName cardSetName)
	{
		_list.Add(cardSetName);
	}

	public void Setup()
	{
		_list.Sort((CardSetName a, CardSetName b) => a.ID.CompareTo(b.ID));
		_listBasicAndPack = _list.FindAll((CardSetName cardSetName) => int.TryParse(cardSetName.ID, out var result) && IsBasicAndStandardPack(result));
	}

	public List<CardSetName> GetList()
	{
		return _list;
	}

	public List<CardSetName> GetListBasicAndPack()
	{
		return _listBasicAndPack;
	}

	public CardSetName Get(string id)
	{
		CardSetName cardSetName = _list.Find((CardSetName x) => x.ID == id);
		if (cardSetName == null)
		{
			return new CardSetName(id, string.Empty, string.Empty);
		}
		return cardSetName;
	}

	private bool IsBasicAndStandardPack(int setId)
	{
		if (!IsBasicSetId(setId))
		{
			return IsStandardPackSetId(setId);
		}
		return true;
	}
}
