// AUTO-GENERATED from armada/tide-table/models.py — DO NOT EDIT.
// Regenerate: python3 tools/gen_ts_types.py  (DRY data layer, #42)

export type AgreeLevel = 'empty' | 'unparsed' | 'no-claim' | 'agree' | 'partial' | 'conflict' | 'divergent'

export type Variant = 'stream' | 'club'

/** A↔C: how well the site's claimed ingredients match the actual score. */
export interface AgreeResult {
  level: AgreeLevel
  precision?: number | null
  jaccard?: number | null
  score_only?: string[]
  metadata_only?: string[]
  shared?: string[]
}

export interface CatalogStats {
  tracks_total: number
  score_present: number
  score_parsed: number
  with_metadata: number
  ac_agree: number
  ac_partial: number
  ac_conflict: number
  ac_divergent: number
  ac_unparsed: number
  ac_no_claim: number
  ac_empty: number
  alias_fragmented: number
  recorded: number
  unrecorded: number
  with_eda: number
  takes_total: number
  takes_with_eda: number
  gigs_total: number
}

export interface LoudTrace {
  trace: number[]
  stepS: number
}

export interface MasterInfo {
  file: string
  I?: number | null
  LRA?: number | null
  TP?: number | null
}

/** One orbit's lane in a take: label DERIVED from the .tidal sound, family VALIDATED by audio (centroid), activity = RMS dB per bin. (#40) */
export interface OrbitActivity {
  orbit: string
  label: string
  group: string
  sound?: string
  centroid?: number | null
  activity: number[]
}

export interface RoleGroup {
  key: string
  label: string
  color: string
  glyph: string
}

export interface Take {
  id: string
  label: string
  gig: string
  date: string
  tidal?: string | null
  dur: number
  binS: number
  masters: Record<Variant, MasterInfo>
  loud: Record<Variant, LoudTrace>
  orbits: OrbitActivity[]
}

/** Corner B candidate: a take this track plausibly lives in (date-join, L0). */
export interface TakeRef {
  take: string
  type: string
  via: string
  method: string
  is_set: boolean
  eda?: string | null
}

/** Corner C facts for one gig appearance (site tracklist, a pointer). */
export interface TrackMeta {
  gig: string
  date?: string
  bpm?: number | null
  style?: string | null
  dur?: number | null
}

/** One track (identity = its .tidal path), reconciled across the three corners. */
export interface TrackRow {
  track: string
  names?: string[]
  name: string
  gigs?: string[]
  metas?: TrackMeta[]
  score_present: boolean
  n_orbits: number
  score?: Record<string, string>
  score_sounds?: string[]
  claimed_sounds?: string[]
  ac: AgreeResult
  takes?: TakeRef[]
  n_takes: number
  n_takes_eda: number
  recorded: boolean
  alias_siblings?: string[]
}

export interface PlayerData {
  track: string
  calibration: string
  activeDb: number
  litFloorDb?: number
  roleGroups: RoleGroup[]
  note?: string
  takes: Take[]
}

export interface Note {
  id: string
  takeId: string
  t: number
  text: string
}

export interface CatalogView {
  schema: string
  as_of: string
  stats: CatalogStats
  tracks?: TrackRow[]
}
