import type { NutritionInfo } from '@meshitrack/shared';

export interface NutritionExtractionResult {
  name?: string;
  brand?: string;
  servingSize?: number;
  servingUnit?: string;
  nutrition: Partial<NutritionInfo>;
}

export interface ParsedIngredient {
  name: string;
  quantity: number;
  unit: string;
}

export interface ParsedRecipe {
  name: string;
  servings: number;
  ingredients: ParsedIngredient[];
  steps: string[];
  prepTime?: number;
  cookTime?: number;
  cuisine?: string;
}

export interface ParsedReceipt {
  items: Array<{ name: string; quantity?: number; price?: number }>;
  total?: number;
  storeName?: string;
  date?: string;
}

export interface MealPlanContext {
  householdId: string;
  targetCalories?: number;
  preferences?: string[];
  avoidances?: string[];
}

export interface MealPlanSuggestion {
  meals: Array<{ name: string; recipeId?: string; calories: number }>;
}

export interface StructuredAction {
  intent: string;
  entities: Record<string, unknown>;
}

export interface ILlmProvider {
  extractNutrition(input: {
    text?: string;
    image?: Buffer;
  }): Promise<NutritionExtractionResult | null>;
  parseRecipe(text: string): Promise<ParsedRecipe | null>;
  parseRecipeFromUrl(url: string): Promise<ParsedRecipe | null>;
  parseReceipt(image: Buffer): Promise<ParsedReceipt | null>;
  suggestMealPlan(context: MealPlanContext): Promise<MealPlanSuggestion | null>;
  parseNaturalLanguage(text: string): Promise<StructuredAction | null>;
}

export const LLM_PROVIDER = Symbol('LLM_PROVIDER');
