import {
  DATA_URL,
  PROCEDURES,
  SportTypes,
} from 'config'
import { callApi, getResponseData } from 'helpers'

const proc = PROCEDURES.get_sport_list

export type SportList = Array<{
  id: SportTypes,
  lexic: number,
}>

export const getSportList = (): Promise<SportList> => {
  const config = {
    body: {
      params: {},
      proc,
    },
  }

  return callApi({
    config,
    url: DATA_URL,
  }).then(getResponseData(proc))
}
