# Path: converter/timeconverter.py
# def unixTimeConverter(timeVar):
# def durationTimeConverter(timeVar):
# 
# Path: steamapi/getheroes.py
# def requestGetHeroes():
#     URL = "https://api.steampowered.com/IEconDOTA2_570/GetHeroes/v0001/?key=" + SteamAPIKey + "&language=en_us"


from converter import timeconverter
from steamapi.getheroes import heroDictionary
from dataIO import dataIO

def displayResult(matchOdotaJson):
    chatLog = matchOdotaJson['chat']
    players = {}
    for player in matchOdotaJson['players']:
        players[player['player_slot']] = {'account_id': player.get('account_id', None),
                                          'personaname': player.get('personaname', None),
                                          'hero_id': player.get('hero_id', None)}

    introTemplate = '####&#009;\n#####&#009; Hover to view [chat log](https://www.opendota.com/matches/{matchid}/chat)\n######&#009;\n\n' \
                    'This chat log was provided by [**OpenDota**](https://www.opendota.com/matches/{matchid}/chat)\'s free replay parsing.\n\n'
    chatHeader = 'Player | Time | Message\n' \
                 ':-- | :-- | :--\n'
    chatLineTemplate = '[](/hero-{heroName}) {playerName} | {time} | {message}\n'

    intro = introTemplate.format(matchid=matchOdotaJson['match_id'])

    print(chatLog)
    chatResult = chatHeader
    for i in range(0, len(chatLog)):

# Path: converter/timeconverter.py
# def unixTimeConverter(timeVar):
# def durationTimeConverter(timeVar):
# 
# Path: steamapi/getheroes.py
# def requestGetHeroes():
#     URL = "https://api.steampowered.com/IEconDOTA2_570/GetHeroes/v0001/?key=" + SteamAPIKey + "&language=en_us"


# Path: displayreddit/drodotachat.py
from converter import timeconverter
from steamapi.getheroes import heroDictionary
from dataIO import dataIO


def displayResult(matchOdotaJson):
    chatLog = matchOdotaJson['chat']
    players = {}
    for player in matchOdotaJson['players']:
        players[player['player_slot']] = {'account_id': player.get('account_id', None),
                                          'personaname': player.get('personaname', None),
                                          'hero_id': player.get('hero_id', None)}

    introTemplate = '####&#009;\n#####&#009; Hover to view [chat log](https://www.opendota.com/matches/{matchid}/chat)\n######&#009;\n\n' \
                    'This chat log was provided by [**OpenDota**](https://www.opendota.com/matches/{matchid}/chat)\'s free replay parsing.\n\n'
    chatHeader = 'Player | Time | Message\n' \
                 ':-- | :-- | :--\n'
    chatLineTemplate = '[](/hero-{heroName}) {playerName} | {time} | {message}\n'

    intro = introTemplate.format(matchid=matchOdotaJson['match_id'])

    print(chatLog)
    chatResult = chatHeader
    for i in range(0, len(chatLog)):

        time = timeconverter.durationTimeConverter(chatLog[i]['time'])