import { useParams } from 'react-router'

import toUpper from 'lodash/toUpper'

import { SportTypes } from 'config'

type SportName = 'FOOTBALL' | 'HOCKEY' | 'BASKETBALL'

export const useSportNameParam = () => {
  const { sportName } = useParams<{ sportName: string }>()

  return {
    sportName,
    sportType: SportTypes[toUpper(sportName) as SportName],
  }
}
