/**
 * Lyra Community Post Template Catalog
 *
 * Each entry has a stable ID that maps to a locale key in:
 *   apps/rebreak-native/locales/{de,en,fr,ar}.json → lyra_posts.<id>
 *
 * The `topic` field mirrors the existing TOPICS enum in lyra-post.ts and is
 * used for throttle-logic and potential future category filtering.
 *
 * Texts live in locale files — this file is locale-agnostic.
 * EN/FR/AR texts are curated by lyra-persona agent (pending).
 *
 * Target: ~60 templates (15 per topic). Currently: 15 scaffolded.
 */

export type LyraPostTopic = 'motivation' | 'tipp' | 'zitat' | 'witzig' | 'news' | 'feature';

export interface LyraPostTemplate {
  id: string;
  topic: LyraPostTopic;
}

export const LYRA_POST_CATALOG: LyraPostTemplate[] = [
  // ── motivation (5) ──────────────────────────────────────────────────────
  { id: 'motivation_quiet_01', topic: 'motivation' },
  { id: 'motivation_quiet_02', topic: 'motivation' },
  { id: 'motivation_quiet_03', topic: 'motivation' },
  { id: 'motivation_distance_01', topic: 'motivation' },
  { id: 'motivation_distance_02', topic: 'motivation' },

  // ── tipp (4) ─────────────────────────────────────────────────────────────
  { id: 'tipp_breath_01', topic: 'tipp' },
  { id: 'tipp_urge_surf_01', topic: 'tipp' },
  { id: 'tipp_habit_replace_01', topic: 'tipp' },
  { id: 'tipp_sos_reminder_01', topic: 'tipp' },

  // ── zitat (2) ────────────────────────────────────────────────────────────
  { id: 'zitat_stoic_01', topic: 'zitat' },
  { id: 'zitat_psychology_01', topic: 'zitat' },

  // ── witzig (2) ───────────────────────────────────────────────────────────
  { id: 'witzig_impulse_01', topic: 'witzig' },
  { id: 'witzig_distraction_01', topic: 'witzig' },

  // ── news (1) ─────────────────────────────────────────────────────────────
  { id: 'news_push_tactics_01', topic: 'news' },

  // ── feature (1) ──────────────────────────────────────────────────────────
  { id: 'feature_sos_01', topic: 'feature' },
];

/**
 * Returns a random template from the catalog.
 * Optional: pass `excludeIds` (e.g. recently used) to avoid repeats.
 */
export function pickRandomTemplate(excludeIds: string[] = []): LyraPostTemplate {
  const pool = LYRA_POST_CATALOG.filter((t) => !excludeIds.includes(t.id));
  const source = pool.length > 0 ? pool : LYRA_POST_CATALOG;
  return source[Math.floor(Math.random() * source.length)];
}
