/**
 * TMDB genre id mappings. Movie and TV use different ids and names for
 * a handful of genres; we keep both lookups so a Jellyfin string genre
 * can be resolved against either type.
 *
 * Reference: TMDB /genre/movie/list and /genre/tv/list (stable values).
 */

export const TMDB_MOVIE_GENRES: Record<string, number> = {
  Action: 28,
  Adventure: 12,
  Animation: 16,
  Comedy: 35,
  Crime: 80,
  Documentary: 99,
  Drama: 18,
  Family: 10751,
  Fantasy: 14,
  History: 36,
  Horror: 27,
  Music: 10402,
  Mystery: 9648,
  Romance: 10749,
  'Science Fiction': 878,
  'TV Movie': 10770,
  Thriller: 53,
  War: 10752,
  Western: 37,
}

export const TMDB_TV_GENRES: Record<string, number> = {
  'Action & Adventure': 10759,
  Action: 10759,
  Adventure: 10759,
  Animation: 16,
  Comedy: 35,
  Crime: 80,
  Documentary: 99,
  Drama: 18,
  Family: 10751,
  Kids: 10762,
  Mystery: 9648,
  News: 10763,
  Reality: 10764,
  'Sci-Fi & Fantasy': 10765,
  'Science Fiction': 10765,
  Fantasy: 10765,
  Soap: 10766,
  Talk: 10767,
  'War & Politics': 10768,
  War: 10768,
  Western: 37,
}

export function tmdbMovieGenreId(name: string): number | null {
  return TMDB_MOVIE_GENRES[name] ?? null
}

export function tmdbTvGenreId(name: string): number | null {
  return TMDB_TV_GENRES[name] ?? null
}
