namespace CraftingApi.Models;

public class CraftingRecipeResponse
{
    public string RecipeKey { get; set; } = string.Empty;

    public string Name { get; set; } = string.Empty;

    public string Category { get; set; } = string.Empty;

    public string StationType { get; set; } = string.Empty;

    public List<CraftingIngredient> Inputs { get; set; } = [];

    public List<CraftingIngredient> Outputs { get; set; } = [];

    public int CraftTimeSeconds { get; set; }

    public bool Enabled { get; set; }

    public static CraftingRecipeResponse FromModel(CraftingRecipe recipe) => new()
    {
        RecipeKey = recipe.RecipeKey,
        Name = recipe.Name,
        Category = recipe.Category,
        StationType = recipe.StationType,
        Inputs = recipe.Inputs.Select(i => new CraftingIngredient { ItemKey = i.ItemKey, Quantity = i.Quantity }).ToList(),
        Outputs = recipe.Outputs.Select(i => new CraftingIngredient { ItemKey = i.ItemKey, Quantity = i.Quantity }).ToList(),
        CraftTimeSeconds = recipe.CraftTimeSeconds,
        Enabled = recipe.Enabled
    };
}
