import datetime
import json
from island.matches import Matches


def basic_info(name):
    matches = Matches(name)
    print(name)
    for m in matches.data:
        info = m.query(cat="game", act="created").raw_data[0]
        config = json.loads(info['info']['config'])
        print(f"{m.name}: network={config['network']['type']}, "
              f"players={len(m.query('player', 'join').raw_data)}, "
              f"game_end_at={info['info']['game_end_at']},"
              f"game_start={datetime.datetime.fromtimestamp(int(info['info']['next_start'])).isoformat()}")


if __name__ == '__main__':
    basic_info("wos-data-no-tr")
    basic_info("wos-data-2022-pd")
    basic_info("wos-data-2022-sd")
