# Path: fladgejt/helpers.py
# def keyed_namedtuple(typename, field_names, **key_fields):
#     '''A variant of namedtuple where some "key fields" have default values.
# 
#     The value of each "key field" is computed from some other fields by
#     combining their values into an encoded string. The key field acts as a
#     shorthand for the original fields in situations where a single string is
#     easier to work with than multiple values. It can be decoded back when
#     needed::
# 
#         T = keyed_namedtuple('T', ['a', 'b', 'c', 'k'], k=['a', 'c'])
#         t = T(a="foo", b="bar", c="baz")
#         assert t.k == encode_key((t.a, t.c))
#         assert decode_key(t.k) == (t.a, t.c)
# 
#     Args:
#         typename: The class name, like in namedtuple.
#         field_names: The list of fields, like in namedtuple. Key fields have
#             to be at the end, after normal fields.
#         key_fields: Keyword arguments of key names and their associated lists
#             of field names, which will be used to compute its default value.
#     Returns:
#         A new class, like returned by namedtuple.
#     '''
#     # Key names have to be in field_names and key args have to exist
#     for key_name, key_args in key_fields.items():
#         if key_name not in field_names or set(key_args) - set(field_names):
#             raise ValueError(typename)
# 
#     result_class = namedtuple(typename, field_names)
# 
#     # Add '=None' to the keys
#     field_names_none = [name + ("=None" if name in key_fields else "")
#                         for name in field_names]
# 
#     # Create code for computing the default values of key_fields
#     key_defs = [_keyed_namedtuple_key_template.format(
#                     key_name=key_name, key_args=', '.join(key_fields[key_name]))
#                 for key_name in field_names if key_name in key_fields]
# 
#     # Create custom __new__ method
#     exec(_keyed_namedtuple_template.format(
#         args_none=', '.join(field_names_none),
#         args=', '.join(field_names),
#         keys=''.join(key_defs)))
# 
#     return result_class


from collections import namedtuple
from .helpers import keyed_namedtuple
ZapisPredmet = keyed_namedtuple('ZapisPredmet', [
    'skratka', 'nazov', 'typ_vyucby', 'semester', 'kredit', 'rozsah_vyucby',
    'jazyk', 'datum_zapisu', 'aktualnost', 'pocet_prihlasenych',
    'maximalne_prihlasenych', 'blok_skratka', 'blok_nazov', 'blok_index',
    'v_bloku_index', 'odporucany_rocnik', 'cast', 'predmet_key'],
    predmet_key=['skratka'])

ZapisVlastnost = namedtuple('ZapisVlastnost', [
    'skratka', 'nazov', 'minimalny_kredit', 'poznamka'])

Hodnotenie = keyed_namedtuple('Hodnotenie', [
    'akademicky_rok', 'skratka', 'nazov', 'typ_vyucby', 'semester', 'kredit',
    'hodn_znamka', 'hodn_termin', 'hodn_datum', 'hodn_znamka_popis',
    'zapisny_list_key', 'predmet_key', 'hodn_key'],
    predmet_key=['skratka'],
    hodn_key=['zapisny_list_key', 'skratka'])

PriebezneHodnotenie = namedtuple('PriebezneHodnotenie', [
    'dovod', 'poc_bodov', 'maximum', 'zaevidoval', 'zapocitavat', 'minimum'])

PriebezneHodnoteniaPredmetu = keyed_namedtuple('PriebezneHodnoteniaPredmetu', [
    'akademicky_rok', 'skratka', 'nazov', 'semester', 'kredit', 'zaznamy',
    'predmet_key'],
    predmet_key=['skratka'])

Priemer = namedtuple('Priemer', [
    'akademicky_rok', 'nazov', 'semester', 'ziskany_kredit', 'predmetov',
    'neabsolvovanych', 'studijny_priemer', 'vazeny_priemer', 'pokusy_priemer',
    'datum_vypoctu'])


# Path: fladgejt/helpers.py
# def keyed_namedtuple(typename, field_names, **key_fields):
#     '''A variant of namedtuple where some "key fields" have default values.
# 
#     The value of each "key field" is computed from some other fields by
#     combining their values into an encoded string. The key field acts as a
#     shorthand for the original fields in situations where a single string is
#     easier to work with than multiple values. It can be decoded back when
#     needed::
# 
#         T = keyed_namedtuple('T', ['a', 'b', 'c', 'k'], k=['a', 'c'])
#         t = T(a="foo", b="bar", c="baz")
#         assert t.k == encode_key((t.a, t.c))
#         assert decode_key(t.k) == (t.a, t.c)
# 
#     Args:
#         typename: The class name, like in namedtuple.
#         field_names: The list of fields, like in namedtuple. Key fields have
#             to be at the end, after normal fields.
#         key_fields: Keyword arguments of key names and their associated lists
#             of field names, which will be used to compute its default value.
#     Returns:
#         A new class, like returned by namedtuple.
#     '''
#     # Key names have to be in field_names and key args have to exist
#     for key_name, key_args in key_fields.items():
#         if key_name not in field_names or set(key_args) - set(field_names):
#             raise ValueError(typename)
# 
#     result_class = namedtuple(typename, field_names)
# 
#     # Add '=None' to the keys
#     field_names_none = [name + ("=None" if name in key_fields else "")
#                         for name in field_names]
# 
#     # Create code for computing the default values of key_fields
#     key_defs = [_keyed_namedtuple_key_template.format(
#                     key_name=key_name, key_args=', '.join(key_fields[key_name]))
#                 for key_name in field_names if key_name in key_fields]
# 
#     # Create custom __new__ method
#     exec(_keyed_namedtuple_template.format(
#         args_none=', '.join(field_names_none),
#         args=', '.join(field_names),
#         keys=''.join(key_defs)))
# 
#     return result_class


# Path: fladgejt/structures.py
from collections import namedtuple
from .helpers import keyed_namedtuple

ZapisPredmet = keyed_namedtuple('ZapisPredmet', [
    'skratka', 'nazov', 'typ_vyucby', 'semester', 'kredit', 'rozsah_vyucby',
    'jazyk', 'datum_zapisu', 'aktualnost', 'pocet_prihlasenych',
    'maximalne_prihlasenych', 'blok_skratka', 'blok_nazov', 'blok_index',
    'v_bloku_index', 'odporucany_rocnik', 'cast', 'predmet_key'],
    predmet_key=['skratka'])

ZapisVlastnost = namedtuple('ZapisVlastnost', [
    'skratka', 'nazov', 'minimalny_kredit', 'poznamka'])

Hodnotenie = keyed_namedtuple('Hodnotenie', [
    'akademicky_rok', 'skratka', 'nazov', 'typ_vyucby', 'semester', 'kredit',
    'hodn_znamka', 'hodn_termin', 'hodn_datum', 'hodn_znamka_popis',
    'zapisny_list_key', 'predmet_key', 'hodn_key'],
    predmet_key=['skratka'],
    hodn_key=['zapisny_list_key', 'skratka'])

PriebezneHodnotenie = namedtuple('PriebezneHodnotenie', [
    'dovod', 'poc_bodov', 'maximum', 'zaevidoval', 'zapocitavat', 'minimum'])

PriebezneHodnoteniaPredmetu = keyed_namedtuple('PriebezneHodnoteniaPredmetu', [
    'akademicky_rok', 'skratka', 'nazov', 'semester', 'kredit', 'zaznamy',
    'predmet_key'],
    predmet_key=['skratka'])

Priemer = namedtuple('Priemer', [
    'akademicky_rok', 'nazov', 'semester', 'ziskany_kredit', 'predmetov',
    'neabsolvovanych', 'studijny_priemer', 'vazeny_priemer', 'pokusy_priemer',
    'datum_vypoctu'])


Termin = keyed_namedtuple('Termin', [