from pprint import pprint

import constants

from db import MySQLConnection
from models import Programme
from models import Module

db = MySQLConnection(
    host=constants.DB_HOST,
    user=constants.DB_USER,
    password=constants.DB_PASS
)

list_program = Programme.fetchall(db)
list_module = Module.fetchall(db)

# print(list_program[0].get_modules())
# print(list_program[0].get_modules_by_semester(1))
# print(list_program[0].get_name())
# __eq__
# print(list_program[0] == list_program[0])

# modules
# print(list_program[0].get_modules()[1][0][0].get_id())
# pprint(list_program[0].get_modules())
# pprint(list_program[0].get_modules_by_semester(1)[0])
# print(list_program[0].get_modules()[1][0][0].get_credit())

db.close()

#
