from generators.ahoughton import AhoughtonGenerator
from render_config import RendererConfig
from problem_renderer import ProblemRenderer
from moonboard import get_moonboard
from adapters.default import DefaultProblemAdapter
from adapters.crg import CRGProblemAdapter
from adapters.ahoughton import AhoughtonAdapter
import json


def main():
    # Create Renderer
    config = RendererConfig()
    renderer = ProblemRenderer(
        get_moonboard(2017), 
        DefaultProblemAdapter(), 
        config
    )
    crg_renderer = ProblemRenderer(
        get_moonboard(2017), 
        CRGProblemAdapter(), 
        config
    )
    
    ahoughton_renderer_2016 = ProblemRenderer(
        get_moonboard(2016),
        AhoughtonAdapter(),
        config
    )
    ahoughton_generator_2016 = AhoughtonGenerator(year=2016, driver_path='C:/.selenium_drivers/chromedriver.exe')

    ahoughton_renderer_2017 = ProblemRenderer(
        get_moonboard(2017),
        AhoughtonAdapter(),
        config
    )
    ahoughton_generator_2017 = AhoughtonGenerator(year=2017, driver_path='C:/.selenium_drivers/chromedriver.exe')
    
    # Load data
    with open('data/problems.json', 'r') as f:
        problems = json.load(f)
        renderer.render_problem(problems['339318'], with_info=True)
    with open('data/crg.json', 'r') as f:
        crg_problems = json.load(f)
        crg_renderer.render_problem(crg_problems['1'])
    # Ahoughton generator and adapter test
    # 2016
    problem = ahoughton_generator_2016.generate()
    ahoughton_renderer_2016.render_problem(problem)
    # 2017
    problem = ahoughton_generator_2017.generate()
    ahoughton_renderer_2017.render_problem(problem)
    

if __name__ == "__main__":
    main()

[((13, 13, 13, 29), 'render_config.RendererConfig', 'RendererConfig', ({}, {}), '()', False, 'from render_config import RendererConfig\n'), ((30, 31, 30, 113), 'generators.ahoughton.AhoughtonGenerator', 'AhoughtonGenerator', (), '', False, 'from generators.ahoughton import AhoughtonGenerator\n'), ((37, 31, 37, 113), 'generators.ahoughton.AhoughtonGenerator', 'AhoughtonGenerator', (), '', False, 'from generators.ahoughton import AhoughtonGenerator\n'), ((15, 8, 15, 27), 'moonboard.get_moonboard', 'get_moonboard', ({(15, 22, 15, 26): '2017'}, {}), '(2017)', False, 'from moonboard import get_moonboard\n'), ((16, 8, 16, 31), 'adapters.default.DefaultProblemAdapter', 'DefaultProblemAdapter', ({}, {}), '()', False, 'from adapters.default import DefaultProblemAdapter\n'), ((20, 8, 20, 27), 'moonboard.get_moonboard', 'get_moonboard', ({(20, 22, 20, 26): '2017'}, {}), '(2017)', False, 'from moonboard import get_moonboard\n'), ((21, 8, 21, 27), 'adapters.crg.CRGProblemAdapter', 'CRGProblemAdapter', ({}, {}), '()', False, 'from adapters.crg import CRGProblemAdapter\n'), ((26, 8, 26, 27), 'moonboard.get_moonboard', 'get_moonboard', ({(26, 22, 26, 26): '2016'}, {}), '(2016)', False, 'from moonboard import get_moonboard\n'), ((27, 8, 27, 26), 'adapters.ahoughton.AhoughtonAdapter', 'AhoughtonAdapter', ({}, {}), '()', False, 'from adapters.ahoughton import AhoughtonAdapter\n'), ((33, 8, 33, 27), 'moonboard.get_moonboard', 'get_moonboard', ({(33, 22, 33, 26): '2017'}, {}), '(2017)', False, 'from moonboard import get_moonboard\n'), ((34, 8, 34, 26), 'adapters.ahoughton.AhoughtonAdapter', 'AhoughtonAdapter', ({}, {}), '()', False, 'from adapters.ahoughton import AhoughtonAdapter\n'), ((41, 19, 41, 31), 'json.load', 'json.load', ({(41, 29, 41, 30): 'f'}, {}), '(f)', False, 'import json\n'), ((44, 23, 44, 35), 'json.load', 'json.load', ({(44, 33, 44, 34): 'f'}, {}), '(f)', False, 'import json\n')]