import type {
  Allergen,
  NutritionDeclaration,
  NutritionProvenance,
  Season,
  StorageLocationType,
  Unit,
} from "@app/shared-types";

/**
 * Seed: kanoniska ingredienser med schablonvärden per 100 g.
 *
 * VIKTIGT (spec §21, §61.1): värdena här är standardiserade uppskattningar
 * ("seed_estimate") för utveckling. Produktionsvägen är import från
 * Livsmedelsverkets öppna livsmedelsdatabas via connectorn – jobbet byter då
 * provenance till "livsmedelsverket". AI hittar ALDRIG på näringsvärden.
 */

export interface SeedIngredient {
  id: string;
  nameSv: string;
  nameEn: string;
  aliases: string[];
  category: string;
  defaultUnit: Unit;
  densityGPerMl?: number;
  gramsPerPiece?: number;
  allergens: Allergen[];
  isVegan: boolean;
  isVegetarian: boolean;
  containsGluten: boolean;
  containsLactose: boolean;
  isPork: boolean;
  isBeef: boolean;
  isAlcohol: boolean;
  nutritionPer100: NutritionDeclaration;
  nutritionProvenance: NutritionProvenance;
  peakSeasons: Season[];
  shelfLifeGuidance?: Partial<Record<StorageLocationType, number>>;
  defaultPriceMinorPerKg?: number;
}

const PROVENANCE: NutritionProvenance = {
  source: "seed_estimate",
  confidence: 0.7,
  verifiedByUser: false,
};

interface N {
  kcal: number;
  p: number;
  k: number;
  f: number;
  mf?: number;
  fib?: number;
  s?: number;
  salt?: number;
}

function per100(n: N): NutritionDeclaration {
  return {
    basis: "per_100_g",
    values: {
      kcal: n.kcal,
      proteinG: n.p,
      carbsG: n.k,
      fatG: n.f,
      saturatedFatG: n.mf ?? 0,
      fiberG: n.fib ?? 0,
      sugarG: n.s ?? 0,
      saltG: n.salt ?? 0,
    },
  };
}

type IngOpts = Partial<
  Omit<
    SeedIngredient,
    "id" | "nameSv" | "nameEn" | "category" | "nutritionPer100" | "nutritionProvenance"
  >
> & {
  n: N;
};

function ing(
  id: string,
  nameSv: string,
  nameEn: string,
  category: string,
  opts: IngOpts,
): SeedIngredient {
  const { n, ...rest } = opts;
  return {
    id,
    nameSv,
    nameEn,
    aliases: rest.aliases ?? [],
    category,
    defaultUnit: rest.defaultUnit ?? "GRAM",
    allergens: rest.allergens ?? [],
    isVegan: rest.isVegan ?? false,
    isVegetarian: rest.isVegetarian ?? false,
    containsGluten: rest.containsGluten ?? false,
    containsLactose: rest.containsLactose ?? false,
    isPork: rest.isPork ?? false,
    isBeef: rest.isBeef ?? false,
    isAlcohol: rest.isAlcohol ?? false,
    nutritionPer100: per100(n),
    nutritionProvenance: PROVENANCE,
    peakSeasons: rest.peakSeasons ?? [],
    ...(rest.densityGPerMl !== undefined ? { densityGPerMl: rest.densityGPerMl } : {}),
    ...(rest.gramsPerPiece !== undefined ? { gramsPerPiece: rest.gramsPerPiece } : {}),
    ...(rest.shelfLifeGuidance !== undefined ? { shelfLifeGuidance: rest.shelfLifeGuidance } : {}),
    ...(rest.defaultPriceMinorPerKg !== undefined
      ? { defaultPriceMinorPerKg: rest.defaultPriceMinorPerKg }
      : {}),
  };
}

const veg = { isVegan: true, isVegetarian: true };
const vgt = { isVegan: false, isVegetarian: true };

export const SEED_INGREDIENTS: SeedIngredient[] = [
  // --- Mejeri & ägg ---
  ing("milk_3", "Standardmjölk 3 %", "Whole milk", "mejeri", {
    ...vgt,
    defaultUnit: "DECILITER",
    densityGPerMl: 1.03,
    allergens: ["milk"],
    containsLactose: true,
    n: { kcal: 60, p: 3.4, k: 4.7, f: 3, mf: 1.9, s: 4.7, salt: 0.1 },
    shelfLifeGuidance: { fridge: 7 },
    defaultPriceMinorPerKg: 1600,
    aliases: ["mjölk", "helmjölk"],
  }),
  ing("milk_1_5", "Mellanmjölk 1,5 %", "Semi-skimmed milk", "mejeri", {
    ...vgt,
    defaultUnit: "DECILITER",
    densityGPerMl: 1.03,
    allergens: ["milk"],
    containsLactose: true,
    n: { kcal: 46, p: 3.5, k: 4.8, f: 1.5, mf: 1, s: 4.8, salt: 0.1 },
    shelfLifeGuidance: { fridge: 7 },
    defaultPriceMinorPerKg: 1500,
    aliases: ["mellanmjölk"],
  }),
  ing("oat_drink", "Havredryck", "Oat drink", "mejeri", {
    ...veg,
    defaultUnit: "DECILITER",
    densityGPerMl: 1.01,
    containsGluten: false,
    n: { kcal: 46, p: 1, k: 6.7, f: 1.5, mf: 0.2, s: 4, salt: 0.1 },
    shelfLifeGuidance: { fridge: 7 },
    defaultPriceMinorPerKg: 2200,
    aliases: ["havremjölk"],
  }),
  ing("cream", "Vispgrädde 40 %", "Whipping cream", "mejeri", {
    ...vgt,
    defaultUnit: "DECILITER",
    densityGPerMl: 1,
    allergens: ["milk"],
    containsLactose: true,
    n: { kcal: 380, p: 2, k: 3, f: 40, mf: 26, s: 3, salt: 0.1 },
    shelfLifeGuidance: { fridge: 7 },
    defaultPriceMinorPerKg: 6500,
  }),
  ing("cooking_cream", "Matlagningsgrädde 15 %", "Cooking cream", "mejeri", {
    ...vgt,
    defaultUnit: "DECILITER",
    densityGPerMl: 1,
    allergens: ["milk"],
    containsLactose: true,
    n: { kcal: 162, p: 2.7, k: 4.2, f: 15, mf: 10, s: 4, salt: 0.1 },
    shelfLifeGuidance: { fridge: 7 },
    defaultPriceMinorPerKg: 5500,
  }),
  ing("creme_fraiche", "Crème fraiche", "Crème fraîche", "mejeri", {
    ...vgt,
    defaultUnit: "DECILITER",
    densityGPerMl: 1,
    allergens: ["milk"],
    containsLactose: true,
    n: { kcal: 292, p: 2.3, k: 3, f: 30, mf: 20, s: 3, salt: 0.1 },
    shelfLifeGuidance: { fridge: 14 },
    defaultPriceMinorPerKg: 6000,
  }),
  ing("quark", "Kvarg naturell", "Quark", "mejeri", {
    ...vgt,
    allergens: ["milk"],
    containsLactose: true,
    n: { kcal: 62, p: 11, k: 3.8, f: 0.3, mf: 0.2, s: 3.8, salt: 0.1 },
    shelfLifeGuidance: { fridge: 10 },
    defaultPriceMinorPerKg: 4500,
    aliases: ["kesella"],
  }),
  ing("yoghurt_natural", "Naturell yoghurt 3 %", "Plain yogurt", "mejeri", {
    ...vgt,
    defaultUnit: "DECILITER",
    densityGPerMl: 1.03,
    allergens: ["milk"],
    containsLactose: true,
    n: { kcal: 61, p: 3.8, k: 4.9, f: 3, mf: 2, s: 4.9, salt: 0.1 },
    shelfLifeGuidance: { fridge: 7 },
    defaultPriceMinorPerKg: 3000,
  }),
  ing("butter", "Smör", "Butter", "mejeri", {
    ...vgt,
    allergens: ["milk"],
    containsLactose: true,
    n: { kcal: 744, p: 0.6, k: 0.7, f: 82, mf: 52, salt: 1.2 },
    shelfLifeGuidance: { fridge: 60 },
    defaultPriceMinorPerKg: 11000,
  }),
  ing("cheese_hard", "Hårdost (t.ex. hushållsost)", "Hard cheese", "mejeri", {
    ...vgt,
    allergens: ["milk"],
    containsLactose: true,
    n: { kcal: 350, p: 26, k: 0, f: 27, mf: 17, salt: 1.2 },
    shelfLifeGuidance: { fridge: 21 },
    defaultPriceMinorPerKg: 12000,
    aliases: ["ost", "riven ost"],
  }),
  ing("vasterbotten_cheese", "Västerbottensost", "Västerbotten cheese", "mejeri", {
    ...vgt,
    allergens: ["milk"],
    containsLactose: true,
    n: { kcal: 390, p: 27, k: 0, f: 31, mf: 20, salt: 1.5 },
    shelfLifeGuidance: { fridge: 21 },
    defaultPriceMinorPerKg: 22000,
  }),
  ing("feta", "Fetaost", "Feta cheese", "mejeri", {
    ...vgt,
    allergens: ["milk"],
    containsLactose: true,
    n: { kcal: 265, p: 14, k: 2, f: 22, mf: 15, salt: 2.7 },
    shelfLifeGuidance: { fridge: 14 },
    defaultPriceMinorPerKg: 13000,
  }),
  ing("halloumi", "Halloumi", "Halloumi", "mejeri", {
    ...vgt,
    allergens: ["milk"],
    containsLactose: true,
    n: { kcal: 321, p: 21, k: 2.2, f: 25, mf: 16, salt: 2.8 },
    shelfLifeGuidance: { fridge: 30 },
    defaultPriceMinorPerKg: 16000,
  }),
  ing("egg", "Ägg", "Egg", "mejeri", {
    ...vgt,
    defaultUnit: "COUNT",
    gramsPerPiece: 58,
    allergens: ["eggs"],
    n: { kcal: 143, p: 12.6, k: 0.7, f: 9.5, mf: 3.1, salt: 0.4 },
    shelfLifeGuidance: { fridge: 30, pantry: 21 },
    defaultPriceMinorPerKg: 6500,
  }),

  // --- Kött & fågel ---
  ing("chicken_breast", "Kycklingfilé", "Chicken breast", "kott_fagel", {
    n: { kcal: 106, p: 22, k: 0, f: 2, mf: 0.6, salt: 0.2 },
    shelfLifeGuidance: { fridge: 2, freezer: 180 },
    defaultPriceMinorPerKg: 13000,
    aliases: ["kyckling", "kycklingbröst"],
  }),
  ing("chicken_thigh", "Kycklinglårfilé", "Chicken thigh", "kott_fagel", {
    n: { kcal: 150, p: 19, k: 0, f: 8, mf: 2.2, salt: 0.2 },
    shelfLifeGuidance: { fridge: 2, freezer: 180 },
    defaultPriceMinorPerKg: 11000,
  }),
  ing("minced_beef", "Nötfärs 10 %", "Minced beef", "kott_fagel", {
    isBeef: true,
    n: { kcal: 176, p: 20, k: 0, f: 10, mf: 4.5, salt: 0.2 },
    shelfLifeGuidance: { fridge: 1, freezer: 120 },
    defaultPriceMinorPerKg: 14000,
    aliases: ["nötfärs"],
  }),
  ing("minced_mixed", "Blandfärs", "Minced pork/beef", "kott_fagel", {
    isPork: true,
    isBeef: true,
    n: { kcal: 220, p: 18, k: 0, f: 16, mf: 7, salt: 0.2 },
    shelfLifeGuidance: { fridge: 1, freezer: 120 },
    defaultPriceMinorPerKg: 10000,
  }),
  ing("falukorv", "Falukorv", "Falu sausage", "kott_fagel", {
    isPork: true,
    isBeef: true,
    n: { kcal: 230, p: 10, k: 6, f: 19, mf: 7, salt: 1.9 },
    shelfLifeGuidance: { fridge: 10 },
    defaultPriceMinorPerKg: 7000,
  }),
  ing("bacon", "Bacon", "Bacon", "kott_fagel", {
    isPork: true,
    n: { kcal: 320, p: 14, k: 1, f: 29, mf: 11, salt: 2.5 },
    shelfLifeGuidance: { fridge: 7, freezer: 60 },
    defaultPriceMinorPerKg: 18000,
  }),
  ing("pork_loin", "Fläskytterfilé", "Pork loin", "kott_fagel", {
    isPork: true,
    n: { kcal: 120, p: 21, k: 0, f: 4, mf: 1.4, salt: 0.1 },
    shelfLifeGuidance: { fridge: 2, freezer: 150 },
    defaultPriceMinorPerKg: 9000,
  }),
  ing("meatball_pork_beef", "Köttbullar (färdiga)", "Meatballs", "kott_fagel", {
    isPork: true,
    isBeef: true,
    n: { kcal: 230, p: 13, k: 7, f: 17, mf: 6.5, salt: 1.8 },
    shelfLifeGuidance: { fridge: 5, freezer: 120 },
    defaultPriceMinorPerKg: 9000,
  }),

  // --- Fisk & skaldjur ---
  ing("salmon", "Laxfilé", "Salmon fillet", "fisk", {
    allergens: ["fish"],
    n: { kcal: 200, p: 20, k: 0, f: 13, mf: 2.5, salt: 0.1 },
    shelfLifeGuidance: { fridge: 2, freezer: 90 },
    defaultPriceMinorPerKg: 25000,
    aliases: ["lax"],
  }),
  ing("cod", "Torskfilé", "Cod fillet", "fisk", {
    allergens: ["fish"],
    n: { kcal: 80, p: 18, k: 0, f: 0.7, mf: 0.1, salt: 0.2 },
    shelfLifeGuidance: { fridge: 2, freezer: 90 },
    defaultPriceMinorPerKg: 30000,
    aliases: ["torsk"],
  }),
  ing("shrimp", "Räkor (skalade)", "Shrimp", "fisk", {
    allergens: ["crustaceans"],
    n: { kcal: 80, p: 18, k: 0, f: 0.8, mf: 0.2, salt: 1.5 },
    shelfLifeGuidance: { fridge: 2, freezer: 90 },
    defaultPriceMinorPerKg: 35000,
  }),
  ing("pickled_herring", "Inlagd sill", "Pickled herring", "fisk", {
    allergens: ["fish"],
    n: { kcal: 180, p: 12, k: 12, f: 10, mf: 2.5, s: 11, salt: 2.2 },
    shelfLifeGuidance: { fridge: 21 },
    defaultPriceMinorPerKg: 12000,
    aliases: ["sill"],
  }),
  ing("anchovy_swedish", "Ansjovis (svensk)", "Swedish anchovy sprats", "fisk", {
    allergens: ["fish"],
    n: { kcal: 170, p: 12, k: 8, f: 10, mf: 2, salt: 6 },
    shelfLifeGuidance: { fridge: 30 },
    defaultPriceMinorPerKg: 18000,
  }),

  // --- Grönsaker ---
  ing("potato", "Potatis", "Potato", "gronsaker", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 180,
    n: { kcal: 80, p: 2, k: 17, f: 0.1, fib: 1.8 },
    shelfLifeGuidance: { pantry: 30, fridge: 45 },
    defaultPriceMinorPerKg: 1500,
    peakSeasons: ["autumn"],
  }),
  ing("new_potato", "Färskpotatis", "New potatoes", "gronsaker", {
    ...veg,
    n: { kcal: 75, p: 1.9, k: 16, f: 0.1, fib: 1.6 },
    shelfLifeGuidance: { pantry: 7, fridge: 10 },
    defaultPriceMinorPerKg: 3000,
    peakSeasons: ["summer"],
  }),
  ing("onion", "Gul lök", "Yellow onion", "gronsaker", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 150,
    n: { kcal: 40, p: 1.2, k: 8, f: 0.1, fib: 1.7, s: 5 },
    shelfLifeGuidance: { pantry: 30 },
    defaultPriceMinorPerKg: 1500,
    aliases: ["lök"],
  }),
  ing("red_onion", "Rödlök", "Red onion", "gronsaker", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 120,
    n: { kcal: 42, p: 1.2, k: 8.5, f: 0.1, fib: 1.7, s: 5.5 },
    shelfLifeGuidance: { pantry: 30 },
    defaultPriceMinorPerKg: 2000,
  }),
  ing("garlic", "Vitlök", "Garlic", "gronsaker", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 5,
    aliases: ["vitlöksklyfta"],
    n: { kcal: 140, p: 6.5, k: 28, f: 0.5, fib: 2 },
    shelfLifeGuidance: { pantry: 60 },
    defaultPriceMinorPerKg: 9000,
  }),
  ing("carrot", "Morot", "Carrot", "gronsaker", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 125,
    n: { kcal: 38, p: 0.7, k: 8, f: 0.2, fib: 2.7, s: 4.5 },
    shelfLifeGuidance: { fridge: 21 },
    defaultPriceMinorPerKg: 1500,
    peakSeasons: ["autumn", "winter"],
  }),
  ing("tomato", "Tomat", "Tomato", "gronsaker", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 125,
    n: { kcal: 20, p: 0.9, k: 3.5, f: 0.2, fib: 1.4, s: 2.6 },
    shelfLifeGuidance: { pantry: 7, fridge: 10 },
    defaultPriceMinorPerKg: 3500,
    peakSeasons: ["summer"],
  }),
  ing("cucumber", "Gurka", "Cucumber", "gronsaker", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 350,
    n: { kcal: 12, p: 0.7, k: 2, f: 0.1, fib: 0.7 },
    shelfLifeGuidance: { fridge: 7 },
    defaultPriceMinorPerKg: 2500,
    peakSeasons: ["summer"],
  }),
  ing("bell_pepper", "Paprika", "Bell pepper", "gronsaker", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 150,
    n: { kcal: 30, p: 1, k: 5, f: 0.3, fib: 1.9, s: 4.5 },
    shelfLifeGuidance: { fridge: 10 },
    defaultPriceMinorPerKg: 4500,
    peakSeasons: ["summer", "autumn"],
  }),
  ing("spinach", "Spenat (färsk)", "Spinach", "gronsaker", {
    ...veg,
    n: { kcal: 25, p: 2.9, k: 1.5, f: 0.4, fib: 2 },
    shelfLifeGuidance: { fridge: 4, freezer: 180 },
    defaultPriceMinorPerKg: 9000,
  }),
  ing("lettuce", "Sallad (huvud)", "Lettuce", "gronsaker", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 300,
    n: { kcal: 15, p: 1.2, k: 2, f: 0.2, fib: 1.3 },
    shelfLifeGuidance: { fridge: 5 },
    defaultPriceMinorPerKg: 6000,
    peakSeasons: ["summer"],
  }),
  ing("broccoli", "Broccoli", "Broccoli", "gronsaker", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 300,
    n: { kcal: 35, p: 3.5, k: 4, f: 0.4, fib: 2.9 },
    shelfLifeGuidance: { fridge: 5, freezer: 180 },
    defaultPriceMinorPerKg: 4000,
  }),
  ing("zucchini", "Zucchini", "Zucchini", "gronsaker", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 300,
    n: { kcal: 17, p: 1.2, k: 3, f: 0.3, fib: 1 },
    shelfLifeGuidance: { fridge: 7 },
    defaultPriceMinorPerKg: 3500,
    peakSeasons: ["summer", "autumn"],
  }),
  ing("leek", "Purjolök", "Leek", "gronsaker", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 200,
    n: { kcal: 30, p: 1.5, k: 5.5, f: 0.3, fib: 2.3 },
    shelfLifeGuidance: { fridge: 14 },
    defaultPriceMinorPerKg: 3500,
    peakSeasons: ["autumn", "winter"],
  }),
  ing("dill", "Dill (färsk)", "Dill", "gronsaker", {
    ...veg,
    n: { kcal: 40, p: 3.5, k: 5, f: 0.8, fib: 2.5 },
    shelfLifeGuidance: { fridge: 5 },
    defaultPriceMinorPerKg: 30000,
    peakSeasons: ["summer"],
  }),
  ing("parsley", "Persilja (färsk)", "Parsley", "gronsaker", {
    ...veg,
    n: { kcal: 45, p: 3.7, k: 6, f: 0.9, fib: 3.5 },
    shelfLifeGuidance: { fridge: 5 },
    defaultPriceMinorPerKg: 30000,
  }),
  ing("basil", "Basilika (färsk)", "Basil", "gronsaker", {
    ...veg,
    n: { kcal: 30, p: 3, k: 2.5, f: 0.6, fib: 1.6 },
    shelfLifeGuidance: { fridge: 4 },
    defaultPriceMinorPerKg: 40000,
    peakSeasons: ["summer"],
  }),
  ing("ginger", "Ingefära (färsk)", "Ginger", "gronsaker", {
    ...veg,
    n: { kcal: 80, p: 1.8, k: 16, f: 0.8, fib: 2 },
    shelfLifeGuidance: { fridge: 21 },
    defaultPriceMinorPerKg: 8000,
  }),
  ing("mushroom", "Champinjoner", "Mushrooms", "gronsaker", {
    ...veg,
    n: { kcal: 25, p: 3, k: 1.5, f: 0.4, fib: 1.5 },
    shelfLifeGuidance: { fridge: 5 },
    defaultPriceMinorPerKg: 6000,
    peakSeasons: ["autumn"],
  }),
  ing("frozen_peas", "Gröna ärtor (frysta)", "Frozen peas", "gronsaker", {
    ...veg,
    n: { kcal: 78, p: 5.5, k: 11, f: 0.5, fib: 5.5, s: 5 },
    shelfLifeGuidance: { freezer: 365 },
    defaultPriceMinorPerKg: 3000,
  }),
  ing("corn", "Majs (konserverad)", "Sweet corn", "gronsaker", {
    ...veg,
    n: { kcal: 90, p: 3, k: 17, f: 1.2, fib: 2.5, s: 5 },
    shelfLifeGuidance: { pantry: 365, fridge: 4 },
    defaultPriceMinorPerKg: 3000,
  }),
  ing("olives", "Oliver", "Olives", "gronsaker", {
    ...veg,
    n: { kcal: 150, p: 1, k: 1, f: 15, mf: 2.2, salt: 3.5 },
    shelfLifeGuidance: { fridge: 30 },
    defaultPriceMinorPerKg: 10000,
  }),
  ing("avocado", "Avokado", "Avocado", "gronsaker", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 200,
    n: { kcal: 160, p: 2, k: 2, f: 15, mf: 3.1, fib: 6.7 },
    shelfLifeGuidance: { pantry: 4, fridge: 7 },
    defaultPriceMinorPerKg: 6000,
  }),

  // --- Frukt & bär ---
  ing("lemon", "Citron", "Lemon", "frukt", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 120,
    n: { kcal: 30, p: 1, k: 9, f: 0.3, fib: 2.8, s: 2.5 },
    shelfLifeGuidance: { pantry: 14, fridge: 30 },
    defaultPriceMinorPerKg: 3000,
  }),
  ing("lime", "Lime", "Lime", "frukt", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 70,
    n: { kcal: 30, p: 0.7, k: 10, f: 0.2, fib: 2.8, s: 1.7 },
    shelfLifeGuidance: { pantry: 14, fridge: 30 },
    defaultPriceMinorPerKg: 4000,
  }),
  ing("apple", "Äpple", "Apple", "frukt", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 180,
    n: { kcal: 52, p: 0.3, k: 12, f: 0.2, fib: 2.4, s: 10 },
    shelfLifeGuidance: { pantry: 14, fridge: 30 },
    defaultPriceMinorPerKg: 2500,
    peakSeasons: ["autumn"],
  }),
  ing("banana", "Banan", "Banana", "frukt", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 120,
    n: { kcal: 89, p: 1.1, k: 20, f: 0.3, fib: 2.6, s: 12 },
    shelfLifeGuidance: { pantry: 5 },
    defaultPriceMinorPerKg: 2500,
  }),
  ing("strawberry", "Jordgubbar", "Strawberries", "frukt", {
    ...veg,
    n: { kcal: 33, p: 0.7, k: 6, f: 0.3, fib: 2, s: 4.9 },
    shelfLifeGuidance: { fridge: 3 },
    defaultPriceMinorPerKg: 6000,
    peakSeasons: ["summer"],
  }),

  // --- Spannmål, pasta, bröd ---
  ing("pasta_dry", "Pasta (torr)", "Dry pasta", "spannmal", {
    ...veg,
    containsGluten: true,
    allergens: ["gluten"],
    n: { kcal: 360, p: 12, k: 72, f: 1.5, fib: 3 },
    shelfLifeGuidance: { pantry: 730 },
    defaultPriceMinorPerKg: 2500,
    aliases: ["spaghetti", "penne", "makaroner"],
  }),
  ing("pasta_gluten_free", "Glutenfri pasta", "Gluten-free pasta", "spannmal", {
    ...veg,
    n: { kcal: 355, p: 7, k: 76, f: 2, fib: 2.5 },
    shelfLifeGuidance: { pantry: 730 },
    defaultPriceMinorPerKg: 4500,
  }),
  ing("rice_white", "Ris (jasmin/basmati, torrt)", "White rice", "spannmal", {
    ...veg,
    densityGPerMl: 0.85,
    n: { kcal: 350, p: 7, k: 78, f: 0.6, fib: 1.4 },
    shelfLifeGuidance: { pantry: 730 },
    defaultPriceMinorPerKg: 3000,
    aliases: ["ris", "jasminris", "basmatiris"],
  }),
  ing("noodles_egg", "Äggnudlar (torra)", "Egg noodles", "spannmal", {
    ...vgt,
    containsGluten: true,
    allergens: ["gluten", "eggs"],
    n: { kcal: 365, p: 13, k: 70, f: 4, fib: 3 },
    shelfLifeGuidance: { pantry: 365 },
    defaultPriceMinorPerKg: 4500,
    aliases: ["nudlar"],
  }),
  ing("flour_wheat", "Vetemjöl", "Wheat flour", "spannmal", {
    ...veg,
    containsGluten: true,
    allergens: ["gluten"],
    densityGPerMl: 0.6,
    n: { kcal: 340, p: 10, k: 70, f: 1.5, fib: 3 },
    shelfLifeGuidance: { pantry: 365 },
    defaultPriceMinorPerKg: 1500,
    aliases: ["mjöl"],
  }),
  ing("oats", "Havregryn", "Rolled oats", "spannmal", {
    ...veg,
    densityGPerMl: 0.37,
    n: { kcal: 370, p: 13, k: 58, f: 7, mf: 1.3, fib: 10 },
    shelfLifeGuidance: { pantry: 365 },
    defaultPriceMinorPerKg: 2000,
  }),
  ing("breadcrumbs", "Ströbröd", "Breadcrumbs", "spannmal", {
    ...veg,
    containsGluten: true,
    allergens: ["gluten"],
    densityGPerMl: 0.55,
    n: { kcal: 360, p: 11, k: 72, f: 2.5, fib: 4, salt: 1 },
    shelfLifeGuidance: { pantry: 365 },
    defaultPriceMinorPerKg: 3000,
  }),
  ing("bread_sourdough", "Surdegsbröd", "Sourdough bread", "brod", {
    ...veg,
    containsGluten: true,
    allergens: ["gluten"],
    n: { kcal: 250, p: 8.5, k: 48, f: 1.5, fib: 3.5, salt: 1.1 },
    shelfLifeGuidance: { pantry: 4, freezer: 90 },
    defaultPriceMinorPerKg: 6000,
    aliases: ["bröd"],
  }),
  ing("tortilla", "Tortillabröd", "Tortilla wraps", "brod", {
    ...veg,
    containsGluten: true,
    allergens: ["gluten"],
    defaultUnit: "COUNT",
    gramsPerPiece: 60,
    n: { kcal: 300, p: 8, k: 50, f: 7, mf: 3, fib: 3, salt: 1.2 },
    shelfLifeGuidance: { pantry: 30 },
    defaultPriceMinorPerKg: 6000,
  }),
  ing("hamburger_bun", "Hamburgerbröd", "Burger buns", "brod", {
    ...vgt,
    containsGluten: true,
    allergens: ["gluten", "sesame"],
    defaultUnit: "COUNT",
    gramsPerPiece: 60,
    n: { kcal: 290, p: 9, k: 50, f: 5, mf: 1, fib: 2.5, s: 6, salt: 1 },
    shelfLifeGuidance: { pantry: 5, freezer: 90 },
    defaultPriceMinorPerKg: 5500,
  }),

  // --- Baljväxter ---
  ing("red_lentils", "Röda linser (torra)", "Red lentils", "baljvaxter", {
    ...veg,
    densityGPerMl: 0.85,
    n: { kcal: 340, p: 24, k: 52, f: 1.5, fib: 11 },
    shelfLifeGuidance: { pantry: 730 },
    defaultPriceMinorPerKg: 4000,
  }),
  ing("chickpeas_canned", "Kikärtor (kokta)", "Chickpeas", "baljvaxter", {
    ...veg,
    n: { kcal: 120, p: 7, k: 17, f: 2.2, fib: 5.5 },
    shelfLifeGuidance: { pantry: 730, fridge: 3 },
    defaultPriceMinorPerKg: 3000,
  }),
  ing("black_beans_canned", "Svarta bönor (kokta)", "Black beans", "baljvaxter", {
    ...veg,
    n: { kcal: 100, p: 7, k: 15, f: 0.5, fib: 7 },
    shelfLifeGuidance: { pantry: 730, fridge: 3 },
    defaultPriceMinorPerKg: 3000,
  }),
  ing("kidney_beans_canned", "Kidneybönor (kokta)", "Kidney beans", "baljvaxter", {
    ...veg,
    n: { kcal: 100, p: 7.5, k: 14, f: 0.6, fib: 7 },
    shelfLifeGuidance: { pantry: 730, fridge: 3 },
    defaultPriceMinorPerKg: 3000,
  }),
  ing("tofu", "Tofu (naturell)", "Tofu", "baljvaxter", {
    ...veg,
    allergens: ["soy"],
    n: { kcal: 120, p: 12, k: 2, f: 7, mf: 1 },
    shelfLifeGuidance: { fridge: 7 },
    defaultPriceMinorPerKg: 8000,
  }),

  // --- Skafferi & konserver ---
  ing("canned_tomatoes", "Krossade tomater", "Canned crushed tomatoes", "konserver", {
    ...veg,
    defaultUnit: "COUNT",
    gramsPerPiece: 400,
    n: { kcal: 30, p: 1.3, k: 5, f: 0.2, fib: 1.5, s: 4 },
    shelfLifeGuidance: { pantry: 730, fridge: 4 },
    defaultPriceMinorPerKg: 2000,
  }),
  ing("tomato_paste", "Tomatpuré", "Tomato paste", "konserver", {
    ...veg,
    densityGPerMl: 1.05,
    n: { kcal: 90, p: 4.3, k: 15, f: 0.5, fib: 4, s: 12 },
    shelfLifeGuidance: { pantry: 365, fridge: 14 },
    defaultPriceMinorPerKg: 4000,
  }),
  ing("coconut_milk", "Kokosmjölk", "Coconut milk", "konserver", {
    ...veg,
    defaultUnit: "DECILITER",
    densityGPerMl: 0.97,
    n: { kcal: 180, p: 1.7, k: 3, f: 18, mf: 16 },
    shelfLifeGuidance: { pantry: 730, fridge: 3 },
    defaultPriceMinorPerKg: 4500,
  }),
  ing("olive_oil", "Olivolja", "Olive oil", "skafferi", {
    ...veg,
    defaultUnit: "TABLESPOON",
    densityGPerMl: 0.92,
    n: { kcal: 884, p: 0, k: 0, f: 100, mf: 14 },
    shelfLifeGuidance: { pantry: 540 },
    defaultPriceMinorPerKg: 10000,
  }),
  ing("rapeseed_oil", "Rapsolja", "Rapeseed oil", "skafferi", {
    ...veg,
    defaultUnit: "TABLESPOON",
    densityGPerMl: 0.92,
    n: { kcal: 884, p: 0, k: 0, f: 100, mf: 7 },
    shelfLifeGuidance: { pantry: 540 },
    defaultPriceMinorPerKg: 5000,
    aliases: ["matolja", "olja"],
  }),
  ing("sugar", "Strösocker", "Sugar", "skafferi", {
    ...veg,
    densityGPerMl: 0.85,
    n: { kcal: 400, p: 0, k: 100, f: 0, s: 100 },
    shelfLifeGuidance: { pantry: 3650 },
    defaultPriceMinorPerKg: 2000,
    aliases: ["socker"],
  }),
  ing("honey", "Honung", "Honey", "skafferi", {
    ...vgt,
    densityGPerMl: 1.4,
    n: { kcal: 320, p: 0.4, k: 80, f: 0, s: 80 },
    shelfLifeGuidance: { pantry: 1095 },
    defaultPriceMinorPerKg: 12000,
  }),
  ing("soy_sauce", "Soja (japansk)", "Soy sauce", "skafferi", {
    ...veg,
    allergens: ["soy", "gluten"],
    containsGluten: true,
    defaultUnit: "TABLESPOON",
    densityGPerMl: 1.15,
    n: { kcal: 60, p: 8, k: 6, f: 0, salt: 15 },
    shelfLifeGuidance: { pantry: 730 },
    defaultPriceMinorPerKg: 8000,
  }),
  ing("fish_sauce", "Fisksås", "Fish sauce", "skafferi", {
    allergens: ["fish"],
    defaultUnit: "TABLESPOON",
    densityGPerMl: 1.2,
    n: { kcal: 45, p: 9, k: 3, f: 0, salt: 24 },
    shelfLifeGuidance: { pantry: 730 },
    defaultPriceMinorPerKg: 9000,
  }),
  ing("red_curry_paste", "Röd currypasta", "Red curry paste", "skafferi", {
    ...veg,
    allergens: [],
    densityGPerMl: 1.05,
    n: { kcal: 120, p: 3, k: 15, f: 5, mf: 1, salt: 6 },
    shelfLifeGuidance: { pantry: 365, fridge: 30 },
    defaultPriceMinorPerKg: 15000,
  }),
  ing("mustard", "Senap", "Mustard", "skafferi", {
    ...veg,
    allergens: ["mustard"],
    densityGPerMl: 1.05,
    n: { kcal: 130, p: 6, k: 10, f: 7, mf: 0.5, s: 8, salt: 2.5 },
    shelfLifeGuidance: { fridge: 90 },
    defaultPriceMinorPerKg: 6000,
  }),
  ing("mayonnaise", "Majonnäs", "Mayonnaise", "skafferi", {
    ...vgt,
    allergens: ["eggs", "mustard"],
    densityGPerMl: 0.95,
    n: { kcal: 680, p: 1, k: 2, f: 75, mf: 6, salt: 1 },
    shelfLifeGuidance: { fridge: 60 },
    defaultPriceMinorPerKg: 7000,
  }),
  ing("vegetable_stock_cube", "Grönsaksbuljongtärning", "Vegetable stock cube", "skafferi", {
    ...veg,
    allergens: ["celery"],
    defaultUnit: "COUNT",
    gramsPerPiece: 10,
    n: { kcal: 220, p: 8, k: 25, f: 10, mf: 5, salt: 45 },
    shelfLifeGuidance: { pantry: 730 },
    defaultPriceMinorPerKg: 20000,
    aliases: ["buljong"],
  }),
  ing("chicken_stock_cube", "Kycklingbuljongtärning", "Chicken stock cube", "skafferi", {
    allergens: ["celery"],
    defaultUnit: "COUNT",
    gramsPerPiece: 10,
    n: { kcal: 230, p: 9, k: 24, f: 11, mf: 5.5, salt: 45 },
    shelfLifeGuidance: { pantry: 730 },
    defaultPriceMinorPerKg: 20000,
  }),
  ing("peanut_butter", "Jordnötssmör", "Peanut butter", "skafferi", {
    ...veg,
    allergens: ["peanuts"],
    n: { kcal: 600, p: 25, k: 12, f: 50, mf: 10, fib: 6, salt: 0.8 },
    shelfLifeGuidance: { pantry: 365 },
    defaultPriceMinorPerKg: 9000,
  }),
  ing("teriyaki_sauce", "Teriyakisås", "Teriyaki sauce", "skafferi", {
    ...veg,
    allergens: ["soy", "gluten"],
    containsGluten: true,
    defaultUnit: "TABLESPOON",
    densityGPerMl: 1.2,
    n: { kcal: 130, p: 4, k: 28, f: 0, s: 22, salt: 8 },
    shelfLifeGuidance: { pantry: 365, fridge: 60 },
    defaultPriceMinorPerKg: 10000,
  }),
  ing("taco_spice", "Tacokrydda", "Taco seasoning", "kryddor", {
    ...veg,
    densityGPerMl: 0.5,
    n: { kcal: 280, p: 8, k: 45, f: 6, fib: 12, salt: 18 },
    shelfLifeGuidance: { pantry: 730 },
    defaultPriceMinorPerKg: 25000,
  }),
  ing("salsa", "Salsa (burk)", "Salsa", "konserver", {
    ...veg,
    n: { kcal: 45, p: 1.5, k: 8, f: 0.3, fib: 1.5, s: 6, salt: 1.5 },
    shelfLifeGuidance: { pantry: 365, fridge: 7 },
    defaultPriceMinorPerKg: 4500,
  }),

  ing("sesame_seeds", "Sesamfrön", "Sesame seeds", "skafferi", {
    ...veg,
    allergens: ["sesame"],
    defaultUnit: "TABLESPOON",
    densityGPerMl: 0.6,
    n: { kcal: 570, p: 18, k: 12, f: 50, mf: 7, fib: 12 },
    shelfLifeGuidance: { pantry: 365 },
    defaultPriceMinorPerKg: 12000,
  }),

  // --- Kryddor & bas ---
  ing("salt", "Salt", "Salt", "kryddor", {
    ...veg,
    defaultUnit: "TEASPOON",
    densityGPerMl: 1.2,
    n: { kcal: 0, p: 0, k: 0, f: 0, salt: 100 },
    shelfLifeGuidance: { pantry: 3650 },
    defaultPriceMinorPerKg: 1500,
  }),
  ing("black_pepper", "Svartpeppar", "Black pepper", "kryddor", {
    ...veg,
    defaultUnit: "MILLILITER",
    densityGPerMl: 0.5,
    n: { kcal: 250, p: 10, k: 44, f: 3.3, fib: 25 },
    shelfLifeGuidance: { pantry: 1095 },
    defaultPriceMinorPerKg: 30000,
    aliases: ["peppar"],
  }),
  ing("paprika_powder", "Paprikapulver", "Paprika powder", "kryddor", {
    ...veg,
    defaultUnit: "TEASPOON",
    densityGPerMl: 0.45,
    n: { kcal: 280, p: 14, k: 34, f: 13, fib: 35 },
    shelfLifeGuidance: { pantry: 1095 },
    defaultPriceMinorPerKg: 25000,
  }),
  ing("cumin", "Spiskummin", "Cumin", "kryddor", {
    ...veg,
    defaultUnit: "TEASPOON",
    densityGPerMl: 0.5,
    n: { kcal: 375, p: 18, k: 44, f: 22, fib: 10 },
    shelfLifeGuidance: { pantry: 1095 },
    defaultPriceMinorPerKg: 30000,
  }),
  ing("chili_flakes", "Chiliflakes", "Chili flakes", "kryddor", {
    ...veg,
    defaultUnit: "MILLILITER",
    densityGPerMl: 0.4,
    n: { kcal: 320, p: 12, k: 50, f: 17, fib: 27 },
    shelfLifeGuidance: { pantry: 1095 },
    defaultPriceMinorPerKg: 35000,
  }),
  ing("oregano_dried", "Oregano (torkad)", "Dried oregano", "kryddor", {
    ...veg,
    defaultUnit: "TEASPOON",
    densityGPerMl: 0.3,
    n: { kcal: 265, p: 9, k: 69, f: 4.3, fib: 42 },
    shelfLifeGuidance: { pantry: 1095 },
    defaultPriceMinorPerKg: 40000,
  }),
  ing("thyme_dried", "Timjan (torkad)", "Dried thyme", "kryddor", {
    ...veg,
    defaultUnit: "TEASPOON",
    densityGPerMl: 0.3,
    n: { kcal: 276, p: 9, k: 64, f: 7.4, fib: 37 },
    shelfLifeGuidance: { pantry: 1095 },
    defaultPriceMinorPerKg: 40000,
  }),
  ing("curry_powder", "Currypulver", "Curry powder", "kryddor", {
    ...veg,
    defaultUnit: "TEASPOON",
    densityGPerMl: 0.45,
    n: { kcal: 325, p: 14, k: 25, f: 14, fib: 33 },
    shelfLifeGuidance: { pantry: 1095 },
    defaultPriceMinorPerKg: 30000,
  }),
  ing("garam_masala", "Garam masala", "Garam masala", "kryddor", {
    ...veg,
    defaultUnit: "TEASPOON",
    densityGPerMl: 0.45,
    n: { kcal: 380, p: 15, k: 45, f: 15, fib: 25 },
    shelfLifeGuidance: { pantry: 1095 },
    defaultPriceMinorPerKg: 35000,
  }),
  ing("turmeric", "Gurkmeja", "Turmeric", "kryddor", {
    ...veg,
    defaultUnit: "TEASPOON",
    densityGPerMl: 0.5,
    n: { kcal: 350, p: 8, k: 65, f: 10, fib: 21 },
    shelfLifeGuidance: { pantry: 1095 },
    defaultPriceMinorPerKg: 25000,
  }),
  ing("cinnamon", "Kanel", "Cinnamon", "kryddor", {
    ...veg,
    defaultUnit: "TEASPOON",
    densityGPerMl: 0.55,
    n: { kcal: 250, p: 4, k: 80, f: 1.2, fib: 53 },
    shelfLifeGuidance: { pantry: 1095 },
    defaultPriceMinorPerKg: 25000,
  }),
  ing("allspice", "Kryddpeppar", "Allspice", "kryddor", {
    ...veg,
    defaultUnit: "MILLILITER",
    densityGPerMl: 0.5,
    n: { kcal: 263, p: 6, k: 72, f: 8.7, fib: 22 },
    shelfLifeGuidance: { pantry: 1095 },
    defaultPriceMinorPerKg: 35000,
  }),
];

export const SEED_INGREDIENT_IDS = new Set(SEED_INGREDIENTS.map((i) => i.id));
