import { API_ROOT, SportTypes } from 'config'
import { callApi } from 'helpers'

type Match = {
  match_id: number,
  sport_id: SportTypes,
}

export type PreviewsData = Array<Match>

type Preview = {
  match_id: number,
  preview: string,
  sport_id: SportTypes,
}

export type Previews = Array<Preview>

export const getMatchesPreviewImages = async (matches: PreviewsData) => {
  const config = {
    body: matches,
  }

  const previews: Previews = await callApi({
    config,
    url: `${API_ROOT}/videoapi/preview`,
  })

  return previews
}
