<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.entur.gbfs</groupId>
        <artifactId>gbfs-validator-java-parent</artifactId>
        <version>2.0.70</version>
    </parent>

    <artifactId>gbfs-validator-java-api</artifactId>
    <name>gbfs-validator-java-api</name>
    <description>gbfs-validator-java-api</description>
    <url>https://github.com/entur/gbfs-validator-java</url>
    <licenses>
        <license>
            <name>EUPL-1.2 with modifications</name>
            <url>https://joinup.ec.europa.eu/software/page/eupl</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <developers>
        <developer>
            <name>Tom Erik Støwer</name>
            <email>tom.erik.stower@entur.org</email>
            <organization>Entur</organization>
            <organizationUrl>http://www.entur.org</organizationUrl>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:ssh://git@github.com/entur/gbfs-validator-java.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/entur/gbfs-validator-java.git</developerConnection>
        <url>https://github.com/entur/gbfs-validator-java/tree/master</url>
        <tag>HEAD</tag>
    </scm>
    <distributionManagement>
        <relocation>
            <groupId>org.mobilitydata</groupId>
            <artifactId>gbfs-validator-java-api</artifactId>
            <version>3.1.0</version>
            <message>This project has moved to MobilityData. Future releases are published under the org.mobilitydata groupId. See https://github.com/MobilityData/gbfs-validator-java</message>
        </relocation>
    </distributionManagement>
    <properties>
        <java.version>17</java.version>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <junit.version>6.0.0</junit.version>
        <mockito.version>5.11.0</mockito.version>
        <junit-platform.version>6.0.0</junit-platform.version>
        <openapi-generator-maven-plugin>7.16.0</openapi-generator-maven-plugin>
        <jacoco-maven-plugin.version>0.8.14</jacoco-maven-plugin.version>
        <!-- empty argLine property, the value is set up by Jacoco during unit tests execution -->
        <argLine></argLine>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>3.5.6</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>

        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>2.2.38</version>
        </dependency>

        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.1.Final</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/jakarta.annotation/jakarta.annotation-api -->
        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <version>3.0.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api -->
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>

        <!-- Add Jackson annotations dependency -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.20</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
            <version>2.8.13</version>
        </dependency>

        <dependency>
            <groupId>org.openapitools</groupId>
            <artifactId>jackson-databind-nullable</artifactId>
            <version>0.2.7</version>
        </dependency>

        <dependency>
            <groupId>org.entur.gbfs</groupId>
            <artifactId>gbfs-validator-java-loader</artifactId>
            <version>2.0.70</version>
        </dependency>

        <dependency>
            <groupId>org.entur.gbfs</groupId>
            <artifactId>gbfs-validator-java</artifactId>
            <version>2.0.70</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>33.5.0-jre</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- JUnit dependencies with aligned versions -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-engine</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-commons</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Spring Boot Test dependencies -->
        <!-- Version managed by spring-boot-dependencies -->
        <!-- JUnit version managed by properties -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Jetty servlet dependency required by Spring Boot Test -->
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-servlet</artifactId>
            <version>11.0.26</version>
            <scope>test</scope>
        </dependency>

        <!-- Jetty util dependency required by Spring Boot Test -->
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-util</artifactId>
            <version>12.1.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>3.5.6</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                            <goal>build-info</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.14.1</version>
                <configuration>
                    <source>17</source>
                    <target>17</target>
                    <release>17</release>
                </configuration>
            </plugin>

            <!-- Jacoco for code coverage -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules />
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Configure Surefire plugin for JUnit 5 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.4</version>
                <configuration>
                    <includes>
                        <include>**/*Test.java</include>
                    </includes>
                    <useModulePath>false</useModulePath>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.junit.jupiter</groupId>
                        <artifactId>junit-jupiter-engine</artifactId>
                        <version>${junit.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.junit.platform</groupId>
                        <artifactId>junit-platform-launcher</artifactId>
                        <version>${junit-platform.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>${openapi-generator-maven-plugin}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${project.basedir}/src/main/resources/public/openapi.yaml</inputSpec>
                            <generatorName>spring</generatorName>
                            <output>${project.build.directory}/generated-sources/openapi</output>
                            <apiPackage>org.entur.gbfs.validator.api.gen</apiPackage>
                            <modelPackage>org.entur.gbfs.validator.api.model</modelPackage>
                            <invokerPackage>org.entur.gbfs.validator.api.handler</invokerPackage>
                            <generateApiTests>false</generateApiTests>
                            <generateModelTests>false</generateModelTests>
                            <ignoreFileOverride>${project.basedir}/.openapi-generator-ignore</ignoreFileOverride>
                            <configOptions>
                                <delegatePattern>true</delegatePattern>
                                <interfaceOnly>false</interfaceOnly>
                                <skipDefaultInterface>false</skipDefaultInterface>
                                <dateLibrary>java8</dateLibrary>
                                <useOneOfInterfaces>false</useOneOfInterfaces>
                                <useOneOfDiscriminatorLookup>true</useOneOfDiscriminatorLookup>
                                <!--                                <useEnumForDiscriminator>true</useEnumForDiscriminator>-->
                                <!--                                <useOneOfInterfaces>true</useOneOfInterfaces>-->
                            </configOptions>
                            <typeMappings>
                                <typeMapping>Double=java.math.BigDecimal</typeMapping>
                            </typeMappings>
                            <!--                            <library>spring-boot</library>-->
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
