<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>de.adorsys.opba</groupId>
        <artifactId>open-banking-gateway</artifactId>
        <version>0.30.0.1</version>
    </parent>

    <artifactId>opba-admin-rest-api</artifactId>
    <name>opba-admin-rest-api</name>

    <properties>
        <!-- Hard reference to root directory. Used to reference pmd and checkstyle files from root.
        Change this if depth changes. Current: /open-banking-gateway/open-banking-gateway -->
        <main.basedir>${project.parent.basedir}</main.basedir>
        <openapi-spec-file-location>${project.basedir}/src/main/resources/static/tpp_admin_api.yml
        </openapi-spec-file-location>
    </properties>


    <dependencies>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
    </dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>io.swagger.codegen.v3</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <version>${swagger-codegen-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${openapi-spec-file-location}</inputSpec>
                            <language>spring</language>
                            <output>${project.build.directory}/generated-sources/open-api</output>
                            <generateApiTests>false</generateApiTests>
                            <generateModelTests>false</generateModelTests>
                            <configOptions>
                                <sourceFolder>src/main/java</sourceFolder>
                                <basePackage>de.adorsys.opba.adminapi.generated</basePackage>
                                <configPackage>de.adorsys.opba.adminapi.config.generated</configPackage>
                                <modelPackage>de.adorsys.opba.adminapi.model.generated</modelPackage>
                                <apiPackage>de.adorsys.opba.adminapi.resource.generated</apiPackage>
                                <interfaceOnly>true</interfaceOnly>
                                <skipOverwrite>true</skipOverwrite>
                                <dateLibrary>java8</dateLibrary>
                                <java8>true</java8>
                                <implicitHeaders>false</implicitHeaders>
                                <delegatePattern>true</delegatePattern>
                                <useTags>true</useTags>
                                <library>spring-mvc</library>
                                <swaggerDocketConfig>false</swaggerDocketConfig>
                                <generateApiDocumentation>false</generateApiDocumentation>
                                <generateModelDocumentation>false</generateModelDocumentation>
                                <generateSupportingFiles>false</generateSupportingFiles>
                                <generateApiTests>false</generateApiTests>
                                <generateModelTests>false</generateModelTests>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>io.swagger.codegen.v3</groupId>
                        <artifactId>swagger-codegen-generators</artifactId>
                        <version>${swagger-codegen-generators.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>${build-helper-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>add-generated-source</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources/open-api/src/main/java</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

