<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2017 Okta
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.okta.sdk</groupId>
        <artifactId>okta-sdk-root</artifactId>
        <version>24.0.1</version>
    </parent>

    <artifactId>okta-sdk-api</artifactId>
    <name>Okta Java SDK :: API</name>
    <description>
        The Okta Java SDK API .jar provides a Java API that your code can use to make calls to the Okta
        API. This .jar is the only compile-time dependency within the Okta SDK project that your code should
        depend on. Implementations of this API (implementation .jars) should be runtime dependencies only.
    </description>
    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <swagger-annotations.version>1.6.8</swagger-annotations.version>
        <openapi-generator.version>7.11.0</openapi-generator.version>
        <jackson-databind-nullable.version>0.2.6</jackson-databind-nullable.version>
        <jakarta-annotation.version>2.1.1</jakarta-annotation.version>
        <jsr305.version>3.0.2</jsr305.version>
        <junit.version>4.13.2</junit.version>
        <com.github.jknack.handlebars.version>4.4.0</com.github.jknack.handlebars.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.okta.commons</groupId>
            <artifactId>okta-config-check</artifactId>
        </dependency>
        <dependency>
            <groupId>com.okta.commons</groupId>
            <artifactId>okta-http-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.okta.commons</groupId>
            <artifactId>okta-commons-lang</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <!-- Swagger annotations -->
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>${swagger-annotations.version}</version>
        </dependency>

        <!-- @Nullable annotation -->
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <version>${jsr305.version}</version>
        </dependency>

        <!-- Apache Http Client 5 -->
        <dependency>
            <groupId>org.apache.httpcomponents.client5</groupId>
            <artifactId>httpclient5</artifactId>
        </dependency>

        <!-- JSON processing: Jackson -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.jaxrs</groupId>
            <artifactId>jackson-jaxrs-json-provider</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openapitools</groupId>
            <artifactId>jackson-databind-nullable</artifactId>
            <version>${jackson-databind-nullable.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <version>${jakarta-annotation.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.github.jknack</groupId>
            <artifactId>handlebars</artifactId>
            <version>${com.github.jknack.handlebars.version}</version>
        </dependency>
        <dependency>
            <groupId>com.github.jknack</groupId>
            <artifactId>handlebars-jackson2</artifactId>
            <version>4.3.1</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
                <version>2.23.0</version>
                <configuration>
                    <directories>
                        <directory>${project.build.directory}/generated-sources</directory>
                    </directories>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>format</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>${openapi-generator.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>org.openapitools</groupId>
                        <artifactId>openapi-generator</artifactId>
                        <version>${openapi-generator.version}</version>
                        <exclusions>
                            <exclusion>
                                <groupId>org.apache.httpcomponents</groupId>
                                <artifactId>httpclient</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${project.basedir}/../src/swagger/api.yaml</inputSpec>
                            <generatorName>java</generatorName>
                            <packageName>com.okta.sdk.resource</packageName>
                            <apiPackage>com.okta.sdk.resource.api</apiPackage>
                            <modelPackage>com.okta.sdk.resource.model</modelPackage>
                            <invokerPackage>com.okta.sdk.resource.client</invokerPackage>
                            <configOptions>
                                <sourceFolder>src/gen/java/main</sourceFolder>
                                <useRuntimeException>true</useRuntimeException>
                                <enumUnknownDefaultCase>true</enumUnknownDefaultCase>
                                <useJakartaEe>true</useJakartaEe>
                            </configOptions>
                            <additionalProperties>serializableModel=true</additionalProperties>
                            <skipValidateSpec>true</skipValidateSpec>
                            <generateModelTests>false</generateModelTests>
                            <generateApiTests>false</generateApiTests>
                            <templateDirectory>src/main/resources/custom_templates</templateDirectory>
                            <library>apache-httpclient</library>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources/openapi</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <source>8</source>
                    <tags>
                        <tag>
                            <name>http.response.details</name>
                            <placement>a</placement>
                            <head>Http Response Details:</head>
                        </tag>
                    </tags>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>ci</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.siom79.japicmp</groupId>
                        <artifactId>japicmp-maven-plugin</artifactId>
                        <configuration>
                            <parameter>
                                <ignoreMissingClasses>true</ignoreMissingClasses>
                            </parameter>
                        </configuration>
                        <executions>
                            <execution>
                                <id>japicmp</id>
                                <goals>
                                    <goal>cmp</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
