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

const proc = PROCEDURES.get_user_preferences

export type UserPreferences = Array<{
  sport: SportTypes,
  tournament_id: number,
}>

export const getUserPreferences = async () => {
  const config = {
    body: {
      params: {},
      proc,
    },
  }

  const response: UserPreferences | null = await callApi({
    config,
    url: DATA_URL,
  })

  return response || []
}
