import type { Tag } from './tag.js';

// Ingredient and Step domain types
export interface Ingredient {
  id: number;
  recipe_id: number;
  position: number;
  quantity?: string | null;
  unit?: string | null;
  item: string;
  notes?: string | null;
}

export interface Step {
  id: number;
  recipe_id: number;
  position: number;
  instruction: string;
}

export interface Recipe {
  id: number;
  title: string;
  description: string | null;
  servings: number | null;
  prep_time_minutes: number | null;
  cook_time_minutes: number | null;
  source_url: string | null;
  image_url: string | null;
  made: boolean;
  rating: number | null;
  notes: string | null;
  created_at: number;
  updated_at: number;
  ingredients: Ingredient[];
  steps: Step[];
  tags: Tag[];
}

export interface CreateRecipeInput {
  title: string;
  description?: string;
  servings?: number;
  prep_time_minutes?: number;
  cook_time_minutes?: number;
  source_url?: string;
  image_url?: string;
  made?: boolean;
  rating?: number;
  notes?: string;
  ingredients: Partial<Omit<Ingredient,"id"|"recipe_id"> & {position?: number}>[];
  steps: Partial<Omit<Step,"id"|"recipe_id"> & {position?: number}>[];
  tagIds?: number[];
}

export interface UpdateRecipeInput {
  title?: string;
  description?: string | null;
  servings?: number | null;
  prep_time_minutes?: number | null;
  cook_time_minutes?: number | null;
  source_url?: string | null;
  image_url?: string | null;
  made?: boolean;
  rating?: number | null;
  notes?: string | null;
  ingredients?: Partial<Omit<Ingredient,"id"|"recipe_id"> & {position?: number}>[];
  steps?: Partial<Omit<Step,"id"|"recipe_id"> & {position?: number}>[];
  tagIds?: number[];
}

export interface RecipeFilters {
  search?: string;
  offset?: number;
  limit?: number;
  tagId?: number | null;
  tagIds?: number[];
}
