import { Prisma } from '@prisma/client'; import { PrismaService } from '../prisma/prisma.service'; import { AiService } from '../ai/ai.service'; import { CreateRecipeDto } from './dto/create-recipe.dto'; import { CreateIngredientDto } from './dto/create-ingredient.dto'; import { ParseMarkdownDto } from './dto/parse-markdown.dto'; import { RecipeMatchingService } from './recipe-matching.service'; export interface AiRecipeSuggestion { name: string; description: string; mainIngredients: string[]; missingIngredients: string[]; estimatedTime: string; } export declare class RecipesService { private readonly prisma; private readonly aiService; private readonly recipeMatchingService; private readonly logger; constructor(prisma: PrismaService, aiService: AiService, recipeMatchingService: RecipeMatchingService); private throwRecipeNotFound; private normalizeIngredientName; private assertProductsActive; private findRecipeByIdOrThrow; private assertAndClaimRecipeOwner; private assertRecipeOwnedByUser; getInventoryPreview(id: number, userId: number): Promise<{ recipe: { id: number; name: string; description: string | null; }; ingredients: { ingredientId: any; productId: any; productName: any; requiredQuantity: number; requiredUnit: any; note: any; availableQuantity: number; availableUnit: any; matchingInventoryItems: { id: any; quantity: any; unit: any; location: any; brand: any; bestBeforeDate: any; }[]; otherInventoryItems: { id: any; quantity: any; unit: any; location: any; convertedQuantity: number; canConvert: boolean; }[]; status: "missing" | "enough" | "unit_mismatch"; fromPantry: boolean; missingQuantity: number; }[]; summary: { totalIngredients: number; enoughCount: number; missingCount: number; unitMismatchCount: number; canCookExactly: boolean; pantryCount: number; }; }>; findAll(userId: number): Promise<({ owner: { id: number; username: string; } | null; ingredients: ({ product: ({ nutrition: { id: number; productId: number; calories: number | null; protein: number | null; fat: number | null; carbohydrates: number | null; salt: number | null; sugar: number | null; fiber: number | null; } | null; } & { name: string; category: string | null; status: string; id: number; categoryId: number | null; normalizedName: string; canonicalName: string | null; isActive: boolean; deletedAt: Date | null; createdAt: Date; updatedAt: Date; ownerId: number; isPrivate: boolean; }) | null; } & { id: number; createdAt: Date; updatedAt: Date; productId: number | null; quantity: Prisma.Decimal | null; unit: string | null; recipeId: number; rawName: string; rawLine: string | null; note: string | null; alternativeProductIds: Prisma.JsonValue | null; matchConfidence: number | null; matchSource: string | null; analysisStatus: string | null; })[]; shares: { userId: number; }[]; } & { name: string; isPublic: boolean; id: number; createdAt: Date; updatedAt: Date; ownerId: number | null; description: string | null; instructions: string | null; imageUrl: string | null; servings: number | null; })[]>; findOne(id: number, userId: number): Promise<{ owner: { id: number; username: string; } | null; ingredients: ({ product: ({ nutrition: { id: number; productId: number; calories: number | null; protein: number | null; fat: number | null; carbohydrates: number | null; salt: number | null; sugar: number | null; fiber: number | null; } | null; } & { name: string; category: string | null; status: string; id: number; categoryId: number | null; normalizedName: string; canonicalName: string | null; isActive: boolean; deletedAt: Date | null; createdAt: Date; updatedAt: Date; ownerId: number; isPrivate: boolean; }) | null; } & { id: number; createdAt: Date; updatedAt: Date; productId: number | null; quantity: Prisma.Decimal | null; unit: string | null; recipeId: number; rawName: string; rawLine: string | null; note: string | null; alternativeProductIds: Prisma.JsonValue | null; matchConfidence: number | null; matchSource: string | null; analysisStatus: string | null; })[]; shares: { userId: number; }[]; } & { name: string; isPublic: boolean; id: number; createdAt: Date; updatedAt: Date; ownerId: number | null; description: string | null; instructions: string | null; imageUrl: string | null; servings: number | null; }>; update(id: number, updateRecipeDto: CreateRecipeDto, userId: number): Promise<{ ingredients: ({ product: ({ nutrition: { id: number; productId: number; calories: number | null; protein: number | null; fat: number | null; carbohydrates: number | null; salt: number | null; sugar: number | null; fiber: number | null; } | null; } & { name: string; category: string | null; status: string; id: number; categoryId: number | null; normalizedName: string; canonicalName: string | null; isActive: boolean; deletedAt: Date | null; createdAt: Date; updatedAt: Date; ownerId: number; isPrivate: boolean; }) | null; } & { id: number; createdAt: Date; updatedAt: Date; productId: number | null; quantity: Prisma.Decimal | null; unit: string | null; recipeId: number; rawName: string; rawLine: string | null; note: string | null; alternativeProductIds: Prisma.JsonValue | null; matchConfidence: number | null; matchSource: string | null; analysisStatus: string | null; })[]; } & { name: string; isPublic: boolean; id: number; createdAt: Date; updatedAt: Date; ownerId: number | null; description: string | null; instructions: string | null; imageUrl: string | null; servings: number | null; }>; remove(id: number, userId: number): Promise; updateImage(id: number, sourceUrl: string, userId: number): Promise<{ owner: { id: number; username: string; } | null; ingredients: ({ product: ({ nutrition: { id: number; productId: number; calories: number | null; protein: number | null; fat: number | null; carbohydrates: number | null; salt: number | null; sugar: number | null; fiber: number | null; } | null; } & { name: string; category: string | null; status: string; id: number; categoryId: number | null; normalizedName: string; canonicalName: string | null; isActive: boolean; deletedAt: Date | null; createdAt: Date; updatedAt: Date; ownerId: number; isPrivate: boolean; }) | null; } & { id: number; createdAt: Date; updatedAt: Date; productId: number | null; quantity: Prisma.Decimal | null; unit: string | null; recipeId: number; rawName: string; rawLine: string | null; note: string | null; alternativeProductIds: Prisma.JsonValue | null; matchConfidence: number | null; matchSource: string | null; analysisStatus: string | null; })[]; shares: { userId: number; }[]; } & { name: string; isPublic: boolean; id: number; createdAt: Date; updatedAt: Date; ownerId: number | null; description: string | null; instructions: string | null; imageUrl: string | null; servings: number | null; }>; setVisibility(id: number, userId: number, isPublic: boolean): Promise<{ owner: { id: number; username: string; } | null; ingredients: ({ product: ({ nutrition: { id: number; productId: number; calories: number | null; protein: number | null; fat: number | null; carbohydrates: number | null; salt: number | null; sugar: number | null; fiber: number | null; } | null; } & { name: string; category: string | null; status: string; id: number; categoryId: number | null; normalizedName: string; canonicalName: string | null; isActive: boolean; deletedAt: Date | null; createdAt: Date; updatedAt: Date; ownerId: number; isPrivate: boolean; }) | null; } & { id: number; createdAt: Date; updatedAt: Date; productId: number | null; quantity: Prisma.Decimal | null; unit: string | null; recipeId: number; rawName: string; rawLine: string | null; note: string | null; alternativeProductIds: Prisma.JsonValue | null; matchConfidence: number | null; matchSource: string | null; analysisStatus: string | null; })[]; shares: { userId: number; }[]; } & { name: string; isPublic: boolean; id: number; createdAt: Date; updatedAt: Date; ownerId: number | null; description: string | null; instructions: string | null; imageUrl: string | null; servings: number | null; }>; shareWithUser(id: number, ownerId: number, username: string): Promise<{ owner: { id: number; username: string; } | null; ingredients: ({ product: ({ nutrition: { id: number; productId: number; calories: number | null; protein: number | null; fat: number | null; carbohydrates: number | null; salt: number | null; sugar: number | null; fiber: number | null; } | null; } & { name: string; category: string | null; status: string; id: number; categoryId: number | null; normalizedName: string; canonicalName: string | null; isActive: boolean; deletedAt: Date | null; createdAt: Date; updatedAt: Date; ownerId: number; isPrivate: boolean; }) | null; } & { id: number; createdAt: Date; updatedAt: Date; productId: number | null; quantity: Prisma.Decimal | null; unit: string | null; recipeId: number; rawName: string; rawLine: string | null; note: string | null; alternativeProductIds: Prisma.JsonValue | null; matchConfidence: number | null; matchSource: string | null; analysisStatus: string | null; })[]; shares: { userId: number; }[]; } & { name: string; isPublic: boolean; id: number; createdAt: Date; updatedAt: Date; ownerId: number | null; description: string | null; instructions: string | null; imageUrl: string | null; servings: number | null; }>; unshareWithUser(id: number, ownerId: number, username: string): Promise<{ owner: { id: number; username: string; } | null; ingredients: ({ product: ({ nutrition: { id: number; productId: number; calories: number | null; protein: number | null; fat: number | null; carbohydrates: number | null; salt: number | null; sugar: number | null; fiber: number | null; } | null; } & { name: string; category: string | null; status: string; id: number; categoryId: number | null; normalizedName: string; canonicalName: string | null; isActive: boolean; deletedAt: Date | null; createdAt: Date; updatedAt: Date; ownerId: number; isPrivate: boolean; }) | null; } & { id: number; createdAt: Date; updatedAt: Date; productId: number | null; quantity: Prisma.Decimal | null; unit: string | null; recipeId: number; rawName: string; rawLine: string | null; note: string | null; alternativeProductIds: Prisma.JsonValue | null; matchConfidence: number | null; matchSource: string | null; analysisStatus: string | null; })[]; shares: { userId: number; }[]; } & { name: string; isPublic: boolean; id: number; createdAt: Date; updatedAt: Date; ownerId: number | null; description: string | null; instructions: string | null; imageUrl: string | null; servings: number | null; }>; create(createRecipeDto: CreateRecipeDto, userId: number): Promise<{ ingredients: ({ product: ({ nutrition: { id: number; productId: number; calories: number | null; protein: number | null; fat: number | null; carbohydrates: number | null; salt: number | null; sugar: number | null; fiber: number | null; } | null; } & { name: string; category: string | null; status: string; id: number; categoryId: number | null; normalizedName: string; canonicalName: string | null; isActive: boolean; deletedAt: Date | null; createdAt: Date; updatedAt: Date; ownerId: number; isPrivate: boolean; }) | null; } & { id: number; createdAt: Date; updatedAt: Date; productId: number | null; quantity: Prisma.Decimal | null; unit: string | null; recipeId: number; rawName: string; rawLine: string | null; note: string | null; alternativeProductIds: Prisma.JsonValue | null; matchConfidence: number | null; matchSource: string | null; analysisStatus: string | null; })[]; } & { name: string; isPublic: boolean; id: number; createdAt: Date; updatedAt: Date; ownerId: number | null; description: string | null; instructions: string | null; imageUrl: string | null; servings: number | null; }>; addIngredient(id: number, ingredient: CreateIngredientDto, userId: number): Promise<{ product: ({ nutrition: { id: number; productId: number; calories: number | null; protein: number | null; fat: number | null; carbohydrates: number | null; salt: number | null; sugar: number | null; fiber: number | null; } | null; } & { name: string; category: string | null; status: string; id: number; categoryId: number | null; normalizedName: string; canonicalName: string | null; isActive: boolean; deletedAt: Date | null; createdAt: Date; updatedAt: Date; ownerId: number; isPrivate: boolean; }) | null; } & { id: number; createdAt: Date; updatedAt: Date; productId: number | null; quantity: Prisma.Decimal | null; unit: string | null; recipeId: number; rawName: string; rawLine: string | null; note: string | null; alternativeProductIds: Prisma.JsonValue | null; matchConfidence: number | null; matchSource: string | null; analysisStatus: string | null; }>; suggestRecipesFromInventory(userId: number): Promise<{ suggestions: AiRecipeSuggestion[]; }>; parseMarkdown(dto: ParseMarkdownDto): Promise<{ name: string; description: string; instructions: string; ingredients: { rawName: string; rawLine: string; alternatives: string[]; quantity: number; unit: string; note: string | null; suggestions: import("./recipe-matching.service").IngredientSuggestion[]; }[]; }>; }