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

type Video = {
  /** id дорожки */
  abc: number,
  duration: number,
  period: number,
  quality: string,
  start_ms: number,
  url: string,
}

export type Videos = Array<Video>

export const getVideos = (
  sportType: SportTypes,
  matchId: number,
): Promise<Videos> => {
  const config = {
    body: {
      match_id: matchId,
      sport_id: sportType,
    },
  }

  return callApi({
    config,
    url: `${API_ROOT}/videoapi`,
  })
}
