#!/usr/bin/env python
# -*- coding: utf-8 -*-

import argparse
import sys
from psas_packet import messages

parser = argparse.ArgumentParser(prog='gen-psas-types')
parser.add_argument('-f', '--file', type=argparse.FileType('w'),
                    default=sys.stdout,
                    help="header file to write to")
args = vars(parser.parse_args())

output = args['file']
output.write("""/**
 * DO NOT EDIT THIS FILE
 *
 * It is automatically generated by <https://github.com/psas/psas_packet
 * See documentation: <http://psas-packet-serializer.readthedocs.org>
 */

#ifndef _PSAS_PACKET_H
#define _PSAS_PACKET_H
#include <stdint.h>

""")

for fourcc, message in messages.MESSAGES.items():
    output.write(message.typedef())
    output.write('\n\n')

output.write("\n#endif\n")

output.close()
