// src/cases.ts // ============================================================================ // CASE RETRIEVAL // ============================================================================ import { getTnaCaseContent, citationToUri } from './tna-client.js'; import type { CaseContent } from './types.js'; export async function getCaseByUri(uri: string): Promise { // Try TNA first const tnaResult = await getTnaCaseContent(uri); if (tnaResult) { return { metadata: tnaResult.metadata, paragraphs: tnaResult.paragraphs, judges: tnaResult.judges, truncated: false, remainingParagraphs: 0, }; } // TODO: Fall back to local database when PostgreSQL is configured return null; } export async function getCaseByCitation(citation: string): Promise { // Convert citation to URI and try TNA const uri = citationToUri(citation); if (uri) { const result = await getCaseByUri(uri); if (result) return result; } // TODO: Fall back to local search by citation when PostgreSQL is configured return null; }