import { Section, Row, SubHeading, Toggle, type PrefsLike } from '../_ui'
import type { HomeShowSettings } from '../../../api/types'

export function HomePageSection({ prefs }: { prefs: PrefsLike }) {
  function row(key: keyof HomeShowSettings, label: string, hint: string) {
    return (
      <Row key={key} label={label} hint={hint}>
        <Toggle value={prefs.home.show[key]} onChange={v => prefs.setHomeShow(key, v)} />
      </Row>
    )
  }
  return (
    <Section id="home-page" title="Home page" description="Pick the rows that show up on your home screen">
      <SubHeading label="Library essentials" />
      {row('continueWatching', 'Continue watching', 'Pick up where you left off')}
      {row('nextUp', 'Next up', 'The next episodes for shows you watch')}
      {row('recentlyAdded', 'Recently added', 'Fresh from your library')}
      {row('trendingWeek', 'Trending this week', 'TMDB weekly trending titles')}
      {row('topRated', 'Top rated in your library', 'The cream of your crop')}
      {row('watchedRecently', 'Watched recently', 'Revisit something you finished')}
      {row('surpriseMe', 'Surprise me', 'A random shake-up from your library')}

      <SubHeading label="Your activity" />
      {row('watchlist', 'Watchlist', 'Saved-for-later items pulled from your Jellyfin "Watchlist" playlist')}
      {row('becauseYouWatched', 'Because you watched', 'Recommendations sourced from your most recent finish')}
      {row('personSpotlights', 'Director / actor spotlights', 'Filmographies of people you watch most')}
      {row('untouched', 'Added but not started', "Recent arrivals you haven't opened")}
      {row('hiddenGems', 'Hidden gems', 'Highly rated unwatched library items')}

      <SubHeading label="Discovery (out of library)" />
      {row('trendingToday', 'Trending today', 'Daily TMDB trending row')}
      {row('criticallyAcclaimed', 'Critically acclaimed - missing', 'Top-rated TMDB titles not in your library')}
      {row('genreDeepDive', 'Genre deep-dive', 'Canon picks from your most-watched genre')}
      {row('cultClassics', 'Cult classics', 'Highly rated, low-popularity TMDB picks')}
      {row('yearEndBestOf', 'Year-end best-ofs', 'Top-rated movies released this year')}
      {row('foreignCinema', 'Foreign cinema', 'Highly rated non-English films')}
      {row('documentaryPicks', 'Documentary picks', 'Top-rated documentaries on TMDB')}
      {row('awardWinnersMissing', 'Award winners - missing', 'Best Picture winners not in your library')}
      {row('discoverCanon', 'Discover canon', 'Bundled AFI / Sight & Sound / IMDb canon lists')}
      {row('letterboxdLists', 'Letterboxd lists', 'Lists you imported via the Letterboxd add affordance')}
      {row('comingSoon', 'Coming soon', 'TMDB upcoming releases for your region')}
      {row('studios', 'Studio rows', 'A row per major film studio - Marvel, A24, Disney, etc.')}
      {row('networks', 'Network rows', 'A row per major TV network - Netflix, HBO, Apple TV+, etc.')}

      <SubHeading label="Generated shelves" />
      {row('moodPicker', "What's your mood?", 'Mood picker that swaps a row of matching picks')}
      {row('smartShelves', 'Smart shelves', 'Rule-based custom shelves you create with the wizard')}
      {row('timeOfDay', 'Time-of-day picks', 'Morning / afternoon / evening / late-night recommendations')}
      {row('decadeRows', 'Decade rows', '1990s / 2000s / 2010s shelves auto-generated from your library')}
      {row('featuredGenres', 'Featured genre rows', 'The Action / Drama / Comedy etc. random shelves')}
    </Section>
  )
}
