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

public class RecipeData
{
    public int RecipeId;
    public string Name;
    public int Price;
    // public string IconSprite;
    public int Volume;
    public int CornAmount;
    public List<(int id, int amount)> Flavors;

    public static RecipeData GetRecipe(int flavorId)
    {
        return GetAllRecipe().FirstOrDefault(x => x.RecipeId == flavorId);
    }

    public static List<RecipeData> GetAllRecipe()
    {
        return SpreadsheetDataManager.Instance.GetBaseDataList<ProductData>(Const.ProductDataSheet).Select(data => new RecipeData
        {
            RecipeId = data.id,
            Name = data.name,
            Price = data.price,
            Volume = data.volume,
            CornAmount = data.MaterialList[0].amount,
            Flavors = data.MaterialList
        }).ToList();
    }
}
