import type { Vec2 } from "../world/geometry.js"; import type { InventoryLayout, InventoryState, ItemTraits } from "../inventory/inventoryModel.js"; export interface RecipeItem { itemId: string; count: number; } export interface RecipeDef { id: string; inputs: readonly RecipeItem[]; outputs: readonly RecipeItem[]; seconds?: number; station?: string; stationRange?: number; requires?: readonly string[]; category?: string; } export interface StationInstance { catalogId: string; position: Vec2; } export interface CraftContext { origin?: Vec2; stations?: readonly StationInstance[]; unlocked?: (id: string) => boolean; } export type CraftRejection = { reason: "missing-inputs"; missing: readonly RecipeItem[]; } | { reason: "no-station"; station: string; } | { reason: "locked"; requires: readonly string[]; } | { reason: "no-output-space"; }; export type CraftCheck = { ok: true; } | ({ ok: false; } & CraftRejection); export type CraftResult = { status: "ok"; state: InventoryState; } | ({ status: "rejected"; } & CraftRejection); export declare function craftSeconds(recipe: RecipeDef): number; export declare function missingInputs(state: InventoryState, recipe: RecipeDef): RecipeItem[]; export declare function hasRecipeInputs(state: InventoryState, recipe: RecipeDef): boolean; export declare function stationSatisfied(recipe: RecipeDef, context: CraftContext): boolean; export declare function canCraft(state: InventoryState, layout: InventoryLayout, traits: ItemTraits, recipe: RecipeDef, context?: CraftContext): CraftCheck; export declare function craft(state: InventoryState, layout: InventoryLayout, traits: ItemTraits, recipe: RecipeDef, context?: CraftContext): CraftResult; export interface RecipeGraph { all(): readonly RecipeDef[]; get(id: string): RecipeDef | null; producing(itemId: string): RecipeDef[]; using(itemId: string): RecipeDef[]; category(categoryId: string): RecipeDef[]; } export declare function createRecipeGraph(defs?: readonly RecipeDef[]): RecipeGraph;