// Shared types for Phase 4 enrichment: dates -> calendar, references -> lookups.
// All detection is pure over Segment text; network lookups send only the
// extracted topic/DOI/ISBN string — never the transcript itself.

/** A detected date/deadline the user can confirm into their calendar. */
export interface CandidateEvent {
  /** Short event title (the surrounding clause, trimmed). */
  title: string;
  /** Resolved absolute time, ms since epoch. */
  dateMs: number;
  /** All-day if no specific time was detected. */
  allDay: boolean;
  /** Source segment for jump-to-lecture. */
  sourceSegmentId?: string;
  /** Audio start time of the source segment. */
  start?: number;
  /** The matched text. */
  raw: string;
  /** 0..1 detection confidence (relative dates are lower). */
  confidence: number;
}

/** A detected citation/reference in the lecture. */
export interface Citation {
  kind: 'doi' | 'arxiv' | 'isbn' | 'author-year';
  /** Normalized id (DOI, arXiv id, ISBN-13/10) or the raw author-year string. */
  value: string;
  sourceSegmentId?: string;
  start?: number;
  raw: string;
}

/** Resolved metadata for a citation, from a legitimate metadata API. */
export interface RefMetadata {
  title?: string;
  authors?: string[];
  year?: number;
  /** Which API answered, e.g. 'Crossref' | 'OpenAlex' | 'Open Library'. */
  source: string;
  /** Canonical URL (DOI resolver, work page, etc.). */
  url?: string;
}

/** Outbound links for finding a reference/book. Legit sources first; the
 *  shadow-library links (Anna's Archive / LibGen) are search URLs only. */
export interface LookupLinks {
  doi?: string;
  arxiv?: string;
  openAlex?: string;
  openLibrary?: string;
  googleBooks?: string;
  wikipedia?: string;
  annasArchive?: string;
  libgen?: string;
}
