/*
 * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.yangtools.yang2sources.spi;

import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;

/**
 * Maven 3.1.x and newer uses SLF4J internally, which means we do not need to pass
 * a logger instance around.
 */
public interface BasicCodeGenerator {
    /**
     * Generate sources from provided {@link SchemaContext}.
     *
     * @param context
     *            parsed from YANG files
     * @param outputBaseDir
     *            expected output directory for generated sources configured by
     *            user
     * @param currentModules
     *            YANG modules parsed from yangFilesRootDir
     * @param moduleResourcePathResolver
     *            Function converting a local module to the packaged resource path
     * @return collection of files that were generated from schema context
     */
    Collection<File> generateSources(SchemaContext context, File outputBaseDir, Set<Module> currentModules,
            Function<Module, Optional<String>> moduleResourcePathResolver) throws IOException;

    /**
     * Provided map contains all configuration that was set in pom for code
     * generator in additionalConfiguration tag.
     */
    void setAdditionalConfig(Map<String, String> additionalConfiguration);

    /**
     * Provided folder is marked as resources and its content will be packaged
     * in resulting jar. Feel free to add necessary resources.
     */
    void setResourceBaseDir(File resourceBaseDir);
}

@@ -820,16 +820,655 @@
 rator %7B%0A
+    enum ImportResolutionMode %7B%0A        /**%0A         * Standard, RFC6020 and RFC7950 compliant mode. Imports are satisfied by exact revision match (if specified),%0A         * or by latest available revision.%0A         */%0A        REVISION_EXACT_OR_LATEST,%0A        /**%0A         * Semantic version based mode. Imports which specify a semantic version (via the OpenConfig extension) will%0A         * be satisfied by module which exports the latest compatible revision. Imports which do not specify semantic%0A         * version will be resolved just as they would be via %7B@link #REVISION_EXACT_OR_LATEST%7D.%0A         */%0A        SEMVER_LATEST,%0A    %7D%0A%0A
     /**%0A
@@ -2654,11 +2654,367 @@
 aseDir);
+%0A%0A    /**%0A     * Indicate import resolution mode this code generator requires. Default implementation indicates%0A     * %7B@link ImportResolutionMode#REVISION_EXACT_OR_LATEST%7D.%0A     *%0A     * @return Import resolution mode.%0A     */%0A    default ImportResolutionMode getImportResolutionMode() %7B%0A        return ImportResolutionMode.REVISION_EXACT_OR_LATEST;%0A    %7D
 %0A%7D%0A

extend plugin SPI with import resolution mode