from enum import Enum

from base_query_parameter import BaseQueryParameter


class Team(BaseQueryParameter, Enum):
    atlanta_hawks = "Atlanta Hawks"
    boston_celtics = "Boston Celtics"
    brooklyn_nets = "Brooklyn Nets"
    charlotte_hornets = "Charlotte Hornets"
    chicago_bulls = "Chicago Bulls"
    cleveland_cavaliers = "Cleveland Cavaliers"
    dallas_mavericks = "Dallas Mavericks"
    denver_nuggets = "Denver Nuggets"
    detroit_pistons = "Detroit Pistons"
    golden_state_warriors = "Golden State Warriors"
    houston_rockets = "Houston Rockets"
    indiana_pacers = "Indiana Pacers"
    los_angeles_clippers = "Los Angeles Clippers"
    los_angeles_lakers = "Los Angeles Lakers"
    memphis_grizzlies = "Memphis Grizzlies"
    miami_heat = "Miami Heat"
    milwaukee_bucks = "Milwaukee Bucks"
    minnesota_timberwolves = "Minnesota Timberwolves"
    new_orleans_pelicans = "New Orleans Pelicans"
    new_york_knicks = "New York Knicks"
    oklahoma_city_thunder = "Oklahoma City Thunder"
    orlando_magic = "Orlando Magic"
    philadelphia_76ers = "Philadelphia 76ers"
    phoenix_suns = "Phoenix Suns"
    portland_trail_blazers = "Portland Trail Blazers"
    sacramento_kings = "Sacramento Kings"
    san_antonio_spurs = "San Antonio Spurs"
    toronto_raptors = "Toronto Raptors"
    utah_jazz = "Utah Jazz"
    washington_wizards = "Washington Wizards"

    @staticmethod
    def get_query_parameter_name():
        return "TeamId"

    @staticmethod
    def get_team_by_id(team_id):
        assert isinstance(team_id, int)

        return team_id_map.get(team_id)

    @staticmethod
    def get_id(team):
        assert isinstance(team, Team)

        return team_to_id_map.get(team)

    @staticmethod
    def get_team_by_abbreviation(abbreviation):
        assert isinstance(abbreviation, basestring)

        team = team_abbreviation_map.get(abbreviation.upper())

        if team is None:
            raise ValueError('Unknown team abbreviation: %s', abbreviation)

        return team_abbreviation_map.get(abbreviation.upper())

    @staticmethod
    def get_team_by_name(name):
        assert isinstance(name, basestring)

        team = team_name_map.get(name)

        if team is None: