/**
 * The 7 values `PlanningItemView.weekDay` is expected to take — lowercase,
 * unaccented French day names. Not enforced by the database (`week_day` is
 * a plain `String` column, see schema.prisma), but enforced at the write
 * boundary by `schemas/planning.ts`'s `addPlanningItemSchema` (`POST
 * /planning/items`) — this is the contract the planning grid (`apps/web`'s
 * `PlanningPage`) reads against, and the one that endpoint writes.
 */
export const WEEK_DAYS = [
  "lundi",
  "mardi",
  "mercredi",
  "jeudi",
  "vendredi",
  "samedi",
  "dimanche",
] as const;
/** Inferred TS type for one {@link WEEK_DAYS} member. */
export type WeekDay = (typeof WEEK_DAYS)[number];

/**
 * The 5 values `PlanningItemView.meal` is expected to take, in day order —
 * same enforcement story as {@link WEEK_DAYS}.
 */
export const MEALS = ["petit-dejeuner", "collation", "dejeuner", "gouter", "diner"] as const;
/** Inferred TS type for one {@link MEALS} member. */
export type Meal = (typeof MEALS)[number];

/**
 * A single meal slot within a household's planning, with its recipe
 * resolved to just enough info for display (id + name) — a caller needing
 * more than that fetches the recipe itself separately.
 */
export interface PlanningItemView {
  id: number;
  /** Day of the week this item falls on — see {@link WeekDay} (free-form for now — no enum exists yet, see schema.prisma). */
  weekDay: string;
  /** Which meal of the day this item is for — see {@link Meal} (free-form for now, same reason). */
  meal: string;
  /** How many portions to prepare for this slot — entered by whoever assigns the recipe (`addPlanningItemSchema`'s `portions`). The picker UI pre-fills this from `Recipe.portions` (see {@link RecipeSummaryView.portions}) but it's still stored independently here, since a slot may scale the recipe up/down from its written yield. */
  portions: number;
  recipe: {
    id: number;
    name: string;
  };
}

/**
 * A household's planning for a date range, as returned by the API. Dates
 * are ISO 8601 strings (JSON has no native date type) — parse with
 * `new Date(...)` client-side if arithmetic is needed.
 */
export interface PlanningView {
  id: number;
  startDate: string;
  finishDate: string;
  items: PlanningItemView[];
}
