import { SITE_URL } from './utilities'

export interface LeagueInfo {
  id: number,
  week: number,
  freeze: boolean,
  season: number,
  transcount: number,
  bstatcount: number,
  pstatcount: number,
  bet_week: number,
  trade_deadline: number,
  pick_trade_start: number,
  pick_trade_end: number,
  playoffs_begin: number,
  injury_count: number
}

export async function fetchCurrentLeagueInfo(): Promise<LeagueInfo> {
  const response = await fetch(`${SITE_URL}/api/v3/current`)

  const leagueInfoResponse: LeagueInfo = await response.json()

  return leagueInfoResponse
}