# Path: nba_data/data/players.py
# class CommonAllPlayer(TeamPlayer):
#     def __init__(self, name, id, team):
#         TeamPlayer.__init__(self, name, id, team)
# 
#     def get_additional_unicode(self):
#         return ''
# 
# Path: nba_data/data/team.py
# 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:
#             raise ValueError('Unknown team name: %s', name)
# 
#         return team


from nba_data.data.players import CommonAllPlayer
from nba_data.data.team import Team


class CommonAllPlayersDeserializer:
    name_index = 2
    team_id_index = 7
    id_index = 0
    result_sets_field_name = 'resultSets'
    row_set_field_name = 'rowSet'
    results_index = 0

    def __init__(self):
        pass

    @staticmethod
    def deserialize(data):
        return [CommonAllPlayersDeserializer.deserialize_result(result=result)
                for result in CommonAllPlayersDeserializer.parse_results(data=data)]

    @staticmethod
    def deserialize_result(result):
        return CommonAllPlayer(name=result[CommonAllPlayersDeserializer.name_index],
                               team=Team.get_team_by_id(team_id=result[CommonAllPlayersDeserializer.team_id_index]),

# Path: nba_data/data/players.py
# class CommonAllPlayer(TeamPlayer):
#     def __init__(self, name, id, team):
#         TeamPlayer.__init__(self, name, id, team)
# 
#     def get_additional_unicode(self):
#         return ''
# 
# Path: nba_data/data/team.py
# 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:
#             raise ValueError('Unknown team name: %s', name)
# 
#         return team


# Path: nba_data/deserializers/common_all_players.py
from nba_data.data.players import CommonAllPlayer
from nba_data.data.team import Team



class CommonAllPlayersDeserializer:
    name_index = 2
    team_id_index = 7
    id_index = 0
    result_sets_field_name = 'resultSets'
    row_set_field_name = 'rowSet'
    results_index = 0

    def __init__(self):
        pass

    @staticmethod
    def deserialize(data):
        return [CommonAllPlayersDeserializer.deserialize_result(result=result)
                for result in CommonAllPlayersDeserializer.parse_results(data=data)]

    @staticmethod
    def deserialize_result(result):
        return CommonAllPlayer(name=result[CommonAllPlayersDeserializer.name_index],
                               team=Team.get_team_by_id(team_id=result[CommonAllPlayersDeserializer.team_id_index]),

                               id=result[CommonAllPlayersDeserializer.id_index])