import plac
from cognos11.c11_export import c11_export
from cognos11.c11_create import c11_create
from config.config import Config
from enum import Enum


class ExportFormat(Enum):
    PDF = "PDF"
    XML = "XML"


class C11:
    commands = ['export', 'reportoutput', 'errors', 'create']

    def export(self, folder='', format='XML'):
        cfg = Config()
        exp = c11_export(cfg)
        exp.export_folder(folder, format)

    def reportoutput(self, folder=''):
        self.export(folder, 'PDF')

    def errors(self):
        cfg = Config()
        exp = c11_export(cfg)
        exp.export_errors()

    def create(self, path: str):
        cfg = Config()
        c11_create(cfg).create_path(path)


if __name__ == '__main__':
    plac.Interpreter.call(C11)
