import fixture from "./inventory.json"; export interface Seed { id: string; name: string; family: string; packets: number; } export const inventory: readonly Seed[] = fixture; export function inspect(id: string): Seed { const seed = inventory.find(item => item.id === id); if (!seed) throw new Error("Unknown seed ID. Query the catalog for valid IDs. Nothing changed."); return seed; } export function query(family?: string): readonly Seed[] { return family ? inventory.filter(seed => seed.family === family) : inventory; } export function summary(seeds: readonly Seed[]): string { return seeds.length ? seeds.map(seed => `${seed.id}: ${seed.name}, ${seed.packets} fictional packets (${seed.family})`).join("\n") : "No fictional seeds match that family."; }