import type { MessageKey } from "@/lib/i18n/messages"
import type { Occurrence, Weekday } from "@/lib/task-form"

/**
 * The two maps that turn a duty's stored numbers into dictionary keys.
 *
 * They were written inside `components/new-task-form.tsx` and needed again the
 * moment a second screen listed saved duties. A `Record` of six keys copied
 * into a second file is a `Record` that gains an occurrence in one of them, so
 * both live here and both screens read the same one.
 *
 * Pure, with nothing under it but two type imports, because the form is a
 * client component and what it imports it puts in the browser.
 */

export const OCCURRENCE_WORD: Record<Occurrence, MessageKey> = {
  once: "occurrence.once",
  daily: "occurrence.daily",
  weekly: "occurrence.weekly",
  monthly: "occurrence.monthly",
  quarterly: "occurrence.quarterly",
  general: "occurrence.general",
}

/** 1 Monday to 7 Sunday, which is what the database stores. */
export const WEEKDAY_WORD: Record<Weekday, MessageKey> = {
  1: "weekday.monday",
  2: "weekday.tuesday",
  3: "weekday.wednesday",
  4: "weekday.thursday",
  5: "weekday.friday",
  6: "weekday.saturday",
  7: "weekday.sunday",
}
