using System.Collections.Generic;

namespace Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase;

public class BuildDeckPurchaseInfo
{
	private List<BuildDeckSeriesPurchaseInfo> _seriesList = new List<BuildDeckSeriesPurchaseInfo>();

	public List<BuildDeckSeriesPurchaseInfo> seriesList => _seriesList;

	public BuildDeckProductInfo GetProductInfo(int productID)
	{
		foreach (BuildDeckSeriesPurchaseInfo series in _seriesList)
		{
			foreach (BuildDeckProductInfo product in series.productList)
			{
				if (product.product_id == productID)
				{
					return product;
				}
			}
		}
		return null;
	}

	public int GetSeriesId(int productID)
	{
		foreach (BuildDeckSeriesPurchaseInfo series in _seriesList)
		{
			foreach (BuildDeckProductInfo product in series.productList)
			{
				if (product.product_id == productID)
				{
					return series._seriesId;
				}
			}
		}
		return -1;
	}
}
