Files
2026-03-26 09:36:42 -05:00

33 lines
1.1 KiB
C#

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
};
}