/**
 * stats-copy.ts — i18n copy builder for the Stats page.
 * Centralises all translation keys so components only import a flat `StatsCopy` object.
 */
import type { TFunction } from "i18next";
import type { StatsDimension } from "@readany/core/stats";

export type StatsCopy = ReturnType<typeof getStatsCopy>;
type GoalPeriod = "monthly" | "yearly";

export function getStatsCopy(t: TFunction) {
  return {
    pageTitle: t("stats.desktop.pageTitle"),
    pageSubtitle: t("stats.desktop.pageSubtitle"),
    dimensions: {
      day: t("stats.desktop.dimensions.day"),
      week: t("stats.desktop.dimensions.week"),
      month: t("stats.desktop.dimensions.month"),
      year: t("stats.desktop.dimensions.year"),
      lifetime: t("stats.desktop.dimensions.lifetime"),
    } satisfies Record<StatsDimension, string>,
    dimensionTitles: {
      day: t("stats.desktop.dimensionTitles.day"),
      week: t("stats.desktop.dimensionTitles.week"),
      month: t("stats.desktop.dimensionTitles.month"),
      year: t("stats.desktop.dimensionTitles.year"),
      lifetime: t("stats.desktop.dimensionTitles.lifetime"),
    } satisfies Record<StatsDimension, string>,
    readingTime: t("stats.desktop.readingTime"),
    activeDays: t("stats.desktop.activeDays"),
    sessions: t("stats.desktop.sessions"),
    books: t("stats.desktop.books"),
    pages: t("stats.desktop.pages"),
    characters: t("stats.desktop.characters"),
    readingSpeed: t("stats.desktop.readingSpeed"),
    streak: t("stats.desktop.streak"),
    avgActiveDay: t("stats.desktop.avgActiveDay"),
    longestSession: t("stats.desktop.longestSession"),
    daysTogether: t("stats.desktop.daysTogether"),
    periodNavigationHint: t("stats.desktop.periodNavigationHint"),
    today: t("stats.desktop.today"),
    thisWeek: t("stats.desktop.thisWeek"),
    thisMonth: t("stats.desktop.thisMonth"),
    thisYear: t("stats.desktop.thisYear"),
    journey: t("stats.desktop.journey"),
    journeySubtitle: t("stats.desktop.journeySubtitle"),
    readingCalendar: t("stats.desktop.readingCalendar"),
    readingCalendarDesc: t("stats.desktop.readingCalendarDesc"),
    primaryChart: t("stats.desktop.primaryChart"),
    primaryChartDesc: t("stats.desktop.primaryChartDesc"),
    readingHeatmap: t("stats.desktop.readingHeatmap"),
    readingHeatmapDesc: t("stats.desktop.readingHeatmapDesc"),
    singlePointLabel: t("stats.desktop.singlePointLabel"),
    singlePointDesc: t("stats.desktop.singlePointDesc"),
    topBooks: t("stats.desktop.topBooks"),
    topBooksDesc: t("stats.desktop.topBooksDesc"),
    insights: t("stats.desktop.insights"),
    insightsDesc: t("stats.desktop.insightsDesc"),
    rhythmProfile: t("stats.desktop.rhythmProfile"),
    rhythmProfileDesc: t("stats.desktop.rhythmProfileDesc"),
    timeOfDay: t("stats.desktop.timeOfDay"),
    timeOfDayDesc: t("stats.desktop.timeOfDayDesc"),
    categoryDistribution: t("stats.desktop.categoryDistribution"),
    categoryDistributionDesc: t("stats.desktop.categoryDistributionDesc"),
    annualShelf: t("stats.desktop.annualShelf"),
    annualShelfDesc: t("stats.desktop.annualShelfDesc"),
    milestones: t("stats.desktop.milestones"),
    milestonesDesc: t("stats.desktop.milestonesDesc"),
    sharePreview: t("stats.desktop.sharePreview"),
    sharePreviewDesc: t("stats.desktop.sharePreviewDesc"),
    noDataTitle: t("stats.desktop.noDataTitle"),
    noDataDesc: t("stats.desktop.noDataDesc"),
    noTopBooks: t("stats.desktop.noTopBooks"),
    noInsights: t("stats.desktop.noInsights"),
    noTimeline: t("stats.desktop.noTimeline"),
    noDayTopBook: t("stats.desktop.noDayTopBook"),
    daySummary: t("stats.desktop.daySummary"),
    daySummaryDesc: t("stats.desktop.daySummaryDesc"),
    firstSession: t("stats.desktop.firstSession"),
    lastSession: t("stats.desktop.lastSession"),
    peakHour: t("stats.desktop.peakHour"),
    longestRead: t("stats.desktop.longestRead"),
    topFocus: t("stats.desktop.topFocus"),
    activeNow: t("stats.desktop.activeNow"),
    startedOn: t("stats.desktop.startedOn"),
    activeReadingDays: t("stats.desktop.activeReadingDays"),
    inactiveReadingDays: t("stats.desktop.inactiveReadingDays"),
    companionMessage: t("stats.desktop.companionMessage"),
    exportSoon: t("stats.desktop.exportSoon"),
    pagesReadSuffix: t("stats.desktop.pagesReadSuffix"),
    charactersReadSuffix: t("stats.desktop.charactersReadSuffix"),
    charactersPerMinuteSuffix: t("stats.desktop.charactersPerMinuteSuffix"),
    sessionsSuffix: t("stats.desktop.sessionsSuffix"),
    daysSuffix: t("stats.desktop.daysSuffix"),
    weekPrefix: t("stats.desktop.weekPrefix"),
    weekSuffix: t("stats.desktop.weekSuffix"),
    unknownAuthor: t("stats.desktop.unknownAuthor"),
    journeyNarrative: (days: number) => t("stats.desktop.journeyNarrative", { days }),
    insightTitleNoReading: t("stats.desktop.insightTitleNoReading"),
    insightBodyNoReading: t("stats.desktop.insightBodyNoReading"),
    insightTitleStreak: t("stats.desktop.insightTitleStreak"),
    insightBodyStreak: (days: number) => t("stats.desktop.insightBodyStreak", { days }),
    insightTitleFocus: t("stats.desktop.insightTitleFocus"),
    insightBodyFocus: (minutes: number) => t("stats.desktop.insightBodyFocus", { minutes }),
    insightTitleTopBook: t("stats.desktop.insightTitleTopBook"),
    insightBodyTopBook: (title: string) => t("stats.desktop.insightBodyTopBook", { title }),
    milestoneTitleJoined: t("stats.desktop.milestoneTitleJoined"),
    milestoneBodyJoined: (date: string) => t("stats.desktop.milestoneBodyJoined", { date }),
    heroNarrativeDay: (time: string, sessions: number) =>
      t("stats.desktop.heroNarrativeDay", { time, sessions }),
    heroNarrativeWeek: (days: number, longest: string) =>
      t("stats.desktop.heroNarrativeWeek", { days, longest }),
    heroNarrativeMonth: (time: string, books: number) =>
      t("stats.desktop.heroNarrativeMonth", { time, books }),
    heroNarrativeYear: (time: string, activeDays: number) =>
      t("stats.desktop.heroNarrativeYear", { time, activeDays }),
    heroNarrativeLifetime: (date: string) => t("stats.desktop.heroNarrativeLifetime", { date }),
    chartPeakLabel: (label: string, value: string) =>
      t("stats.desktop.chartPeakLabel", { label, value }),
    topBookLead: t("stats.desktop.topBookLead"),
    heatmapLegendLow: t("stats.desktop.heatmapLegendLow"),
    heatmapLegendHigh: t("stats.desktop.heatmapLegendHigh"),
    uncategorized: t("stats.desktop.uncategorized"),
    timeOfDayLabels: {
      lateNight: t("stats.desktop.timeOfDayLabels.lateNight"),
      earlyMorning: t("stats.desktop.timeOfDayLabels.earlyMorning"),
      morning: t("stats.desktop.timeOfDayLabels.morning"),
      afternoon: t("stats.desktop.timeOfDayLabels.afternoon"),
      evening: t("stats.desktop.timeOfDayLabels.evening"),
      night: t("stats.desktop.timeOfDayLabels.night"),
    },
    loadFailed: t("stats.loadFailed"),
    loading: t("stats.loading"),
    daySessions: (count: number) => t("stats.desktop.daySessions", { count }),
    activeDaysSummary: (count: number) => t("stats.desktop.activeDaysSummary", { count }),
    // Goals
    goals: t("stats.desktop.goals"),
    goalsDesc: t("stats.desktop.goalsDesc"),
    goalsTitle: (period: GoalPeriod) =>
      t(period === "yearly" ? "stats.desktop.goalsTitleYearly" : "stats.desktop.goalsTitleMonthly"),
    goalsDescription: (period: GoalPeriod) =>
      t(period === "yearly" ? "stats.desktop.goalsDescYearly" : "stats.desktop.goalsDescMonthly"),
    setGoal: t("stats.desktop.setGoal"),
    editGoal: t("stats.desktop.editGoal"),
    removeGoal: t("stats.desktop.removeGoal"),
    goalBooks: t("stats.desktop.goalBooks"),
    goalTime: t("stats.desktop.goalTime"),
    goalCharacters: t("stats.desktop.goalCharacters"),
    goalPages: t("stats.desktop.goalPages"),
    goalMonthly: t("stats.desktop.goalMonthly"),
    goalYearly: t("stats.desktop.goalYearly"),
    goalTarget: t("stats.desktop.goalTarget"),
    goalOnTrack: t("stats.desktop.goalOnTrack"),
    goalBehindPace: t("stats.desktop.goalBehindPace"),
    goalComplete: t("stats.desktop.goalComplete"),
    goalRemaining: t("stats.desktop.goalRemaining"),
    goalBooksUnit: t("stats.desktop.goalBooksUnit"),
    goalTimeUnit: t("stats.desktop.goalTimeUnit"),
    goalCharactersUnit: t("stats.desktop.goalCharactersUnit"),
    goalCharactersInputUnit: t("stats.desktop.goalCharactersInputUnit"),
    goalPagesUnit: t("stats.desktop.goalPagesUnit"),
    noGoals: t("stats.desktop.noGoals"),
    goalCancel: t("stats.desktop.goalCancel"),
    topBooksCollapse: t("stats.desktop.topBooksCollapse"),
    topBooksExpandCount: (count: number) => t("stats.desktop.topBooksExpandCount", { count }),
    // Badges
    badges: t("stats.desktop.badges"),
    badgesDesc: t("stats.desktop.badgesDesc"),
    noBadges: t("stats.desktop.noBadges"),
  };
}
