using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
namespace Content.Shared.Kitchen
{
///
/// A recipe for space microwaves.
///
[Prototype("microwaveMealRecipe")]
public sealed partial class FoodRecipePrototype : IPrototype
{
[ViewVariables]
[IdDataField]
public string ID { get; private set; } = default!;
[DataField("name")]
private string _name = string.Empty;
[DataField]
public string Group = "Other";
[DataField("reagents", customTypeSerializer:typeof(PrototypeIdDictionarySerializer))]
private Dictionary _ingsReagents = new();
[DataField("solids", customTypeSerializer: typeof(PrototypeIdDictionarySerializer))]
private Dictionary _ingsSolids = new ();
[DataField("result", customTypeSerializer: typeof(PrototypeIdSerializer))]
public string Result { get; private set; } = string.Empty;
[DataField("time")]
public uint CookTime { get; private set; } = 5;
public string Name => Loc.GetString(_name);
// TODO Turn this into a ReagentQuantity[]
public IReadOnlyDictionary IngredientsReagents => _ingsReagents;
public IReadOnlyDictionary IngredientsSolids => _ingsSolids;
///
/// Is this recipe unavailable in normal circumstances?
///
[DataField]
public bool SecretRecipe = false;
///
/// Count the number of ingredients in a recipe for sorting the recipe list.
/// This makes sure that where ingredient lists overlap, the more complex
/// recipe is picked first.
///
public FixedPoint2 IngredientCount()
{
FixedPoint2 n = 0;
n += _ingsReagents.Count; // number of distinct reagents
foreach (FixedPoint2 i in _ingsSolids.Values) // sum the number of solid ingredients
{
n += i;
}
return n;
}
}
}