package leigh.kensho.sdk;

import leigh.eo.EO;
import leigh.eo.schema.DAOGenerator;
import leigh.eo.schema.dao.SchemaUtil;
import leigh.mecha.log.MechaLogger;
import leigh.mecha.log.MechaLoggerFactory;
import leigh.mecha.util.UniversalJob;

import java.io.File;
import java.io.FileNotFoundException;

public class KenshoSchemaGeneratorApp {
    private static final MechaLogger logger = MechaLoggerFactory.getLogger(KenshoSchemaGeneratorApp.class);

    public static EO generate() {
        final EO schema = SchemaUtil.create(SchemaUtil.API_KEY);
        return schema;
    }

    public static void main(final String... args) throws FileNotFoundException {
        UniversalJob.banner(logger, "Apotheosis mk3", "2014 Alex Leigh");
        final EO schema = generate();
        final DAOGenerator gen = new DAOGenerator(new File("leigh-esp-kensho-sdk/src/main/java"));
        gen.generateJava("leigh.esp.kensho.sdk.schema.v1", schema);

        logger.info("Generated schema: {}", schema);
    }
}

