package cn.ibizlab.codegen.templating;


public enum TemplateFileType {
    ctrl(Constants.CTRLS),
    page(Constants.PAGES),
    appEntity(Constants.APP_ENTITIES),
    apiEntity(Constants.API_ENTITIES),
    apiDto(Constants.API_DTOS),
    entity(Constants.ENTITIES),
    module(Constants.MODULES),
    workflow(Constants.WORKFLOWS),
    sysUtil(Constants.SYSUTILS),
    clientService(Constants.CLIENTS),
    clientEntity(Constants.CLIENT_ENTITIES),
    api(Constants.APIS),
    app(Constants.APPS),
    dict(Constants.DICTS),
    supportingFiles(Constants.SUPPORTING_FILES);

    private final String templateType;

    TemplateFileType(String templateType) {
        this.templateType = templateType;
    }

    /**
     * Returns the value for this template file type
     *
     * @return The template type of this enum.
     */
    public String value() {
        return this.templateType;
    }


    /**
     * Obtains the {@link TemplateFileType} for an input string.
     *
     * @param templateType a {@link String} object.
     * @return a {@link TemplateFileType} object.
     */
    public static TemplateFileType forTemplateType(String templateType) {
        for (TemplateFileType value : values()) {
            if (value.templateType.equalsIgnoreCase(templateType)||value.name().equalsIgnoreCase(templateType)) {
                return value;
            }
        }
        return null;
    }

    public static class Constants {
        public static final String APIS = "apis";
        public static final String APPS = "apps";
        public static final String DICTS = "dicts";
        public static final String ENTITIES = "entities";
        public static final String WORKFLOWS = "workflows";
        public static final String SYSUTILS = "syUtils";
        public static final String CLIENTS = "clients";
        public static final String CLIENT_ENTITIES = "clientEntities";
        public static final String API_ENTITIES = "apiEntities";
        public static final String API_DTOS = "apiDtos";
        public static final String APP_ENTITIES = "appEntities";
        public static final String MODULES = "modules";
        public static final String PAGES = "pages";
        public static final String CTRLS = "ctrls";
        public static final String SUPPORTING_FILES = "supportingFiles";
    }
}
