// Tīrtha (sacred geography) module barrel. Re-exports the module's types + data
// and defines the lookup helpers. Standalone like `vaar/` — no `Category` value
// and no `getContentForDeity` wiring (this is geographic reference, not
// deity-keyed recitation); reverse lookup is via `getTirthasForDeity`.
import type { Bilingual, Deity } from '../types.js'
import type { TirthaEntry } from './types.js'
import { JYOTIRLINGAS } from './jyotirlingas.js'
import { SHAKTI_PEETHAS } from './shakti-peethas.js'
import { CHAR_DHAM, CHOTA_CHAR_DHAM } from './char-dham.js'
import { SAPTA_PURI } from './sapta-puri.js'
import { SACRED_RIVERS } from './sacred-rivers.js'

export type * from './types.js'
export { JYOTIRLINGAS, DVADASHA_JYOTIRLINGA_STOTRA } from './jyotirlingas.js'
export { SHAKTI_PEETHAS } from './shakti-peethas.js'
export { CHAR_DHAM, CHOTA_CHAR_DHAM } from './char-dham.js'
export { SAPTA_PURI, SAPTA_PURI_SLOKA } from './sapta-puri.js'
export { SACRED_RIVERS, SAPTA_NADI_SLOKA } from './sacred-rivers.js'

/** The 12 Dvādaśa Jyotirliṅga (Śiva), in canonical stotra order. */
export function getJyotirlingas(): readonly TirthaEntry[] {
  return JYOTIRLINGAS
}

/** The 60 Śakti Pīṭha records (51 Sati-aṅga spine + 9 non-overlapping Aṣṭādaśa Mahā). */
export function getShaktiPeethas(): readonly TirthaEntry[] {
  return SHAKTI_PEETHAS
}

/** The four pan-India Char Dhām (Śaṅkarācārya). */
export function getCharDham(): readonly TirthaEntry[] {
  return CHAR_DHAM
}

/** The four-site Chota Char Dhām Himalayan circuit (Uttarakhand). */
export function getChotaCharDham(): readonly TirthaEntry[] {
  return CHOTA_CHAR_DHAM
}

/** The seven mokṣa-giving holy cities (Sapta Purī). */
export function getSaptaPuri(): readonly TirthaEntry[] {
  return SAPTA_PURI
}

/** The seven sacred rivers (sapta nadī). */
export function getSacredRivers(): readonly TirthaEntry[] {
  return SACRED_RIVERS
}

/** Every tīrtha across all six lists, concatenated. */
export function getAllTirthas(): readonly TirthaEntry[] {
  return [
    ...JYOTIRLINGAS,
    ...SHAKTI_PEETHAS,
    ...CHAR_DHAM,
    ...CHOTA_CHAR_DHAM,
    ...SAPTA_PURI,
    ...SACRED_RIVERS,
  ]
}

/** Look up a single tīrtha by its (module-unique) `id`; `undefined` if unknown. */
export function getTirtha(id: string): TirthaEntry | undefined {
  return getAllTirthas().find((t) => t.id === id)
}

/** Every tīrtha whose presiding `deity` cross-links to the given roster slug. */
export function getTirthasForDeity(deity: Deity): readonly TirthaEntry[] {
  return getAllTirthas().filter((t) => t.deity === deity)
}

/**
 * Plain disclaimer for a detail-screen footer. Deliberately names no sources —
 * research provenance lives in `tirtha/SOURCES.md` and in code comments, never
 * in consumer UI. (Audited source-free, like `VAAR_SOURCES`.)
 */
export const TIRTHA_SOURCES: Bilingual = {
  en: 'Sacred-geography lists, body-part attributions and site identifications vary by tradition and region — this is one widely-followed account. For pilgrimage, follow local temple and pandit guidance.',
  hi: 'तीर्थ-सूचियाँ, अंग-निर्धारण एवं स्थान-पहचान परंपरा एवं क्षेत्र के अनुसार भिन्न होती हैं — यह एक व्यापक रूप से मान्य विवरण है। तीर्थयात्रा के लिए स्थानीय मंदिर एवं पंडित जी के मार्गदर्शन का अनुसरण करें।',
}
