import { describe, expect, it } from 'vitest'
import { buildAddRadarrMovieBody } from './radarr'
import { buildAddSonarrSeriesBody } from './sonarr'

describe('request payload builders', () => {
  it('builds Radarr movie add payload defaults', () => {
    expect(buildAddRadarrMovieBody({
      tmdbId: 550,
      qualityProfileId: 3,
      rootFolderPath: 'D:/Movies',
      title: 'Fight Club',
      titleSlug: 'fight-club-1999',
      year: 1999,
      searchOnAdd: false,
    })).toMatchObject({
      tmdbId: 550,
      monitored: true,
      minimumAvailability: 'released',
      addOptions: { searchForMovie: false, monitor: 'movieOnly' },
      images: [],
      tags: [],
    })
  })

  it('builds Sonarr series add payload with optional language profile', () => {
    expect(buildAddSonarrSeriesBody({
      tvdbId: 121361,
      qualityProfileId: 7,
      rootFolderPath: 'D:/Shows',
      languageProfileId: 2,
      monitored: false,
      seasonFolder: false,
      title: 'Game of Thrones',
      titleSlug: 'game-of-thrones',
      year: 2011,
      seasons: [],
      searchOnAdd: false,
    })).toMatchObject({
      tvdbId: 121361,
      monitored: false,
      seasonFolder: false,
      languageProfileId: 2,
      addOptions: {
        searchForMissingEpisodes: false,
        searchForCutoffUnmetEpisodes: false,
        monitor: 'all',
      },
    })
  })
})
