

import json, sys, os

if len(sys.argv) > 1:
    first_argument = sys.argv[1]
    print("The first command-line argument is:", first_argument)
else:
    print("No command-line arguments provided.")
    exit()

def load(name):
    file = open(sys.argv[1], 'r', encoding='utf-8').read()
    dbdump = json.loads(file)
    return dbdump

def save(val,name):
    pretty = json.dumps(val, indent=2).encode().decode('unicode-escape')
    open(name, 'w', encoding='utf-8').write(pretty)


dd = load(sys.argv[1])


ass = {
    "$type": "System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib],[System.Int32, mscorlib]], mscorlib"
}


for e in dd:
    print(e['EvaluationMessageTypeId'],':',e['EvaluationMessageTypeCategoryId'])
    ass[e['EvaluationMessageTypeId']] = int(e['EvaluationMessageTypeCategoryId'])

save(ass, os.path.dirname(os.path.realpath(sys.argv[1])) + '/EvaluationMessageTypeCategoriesAssociation.json')



print('done')