<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>

  <groupId>io.featurehub.sdk</groupId>
  <artifactId>java-client-api</artifactId>
  <version>3.1</version>
  <name>java-client-api</name>

  <description>
    The generated Edge API.
  </description>

  <url>https://featurehub.io</url>
  <developers>
    <developer>
      <email>irina@featurehub.io</email>
      <id>isouthwell</id>
      <name>Irina Southwell</name>
      <organization>Anyways Labs Ltd</organization>
    </developer>

    <developer>
      <email>richard@featurehub.io</email>
      <id>rvowles</id>
      <name>Richard Vowles</name>
      <organization>Anyways Labs Ltd</organization>
    </developer>
  </developers>

  <licenses>
    <license>
      <name>MIT</name>
      <url>https://opensource.org/licenses/MIT</url>
      <comments>This code resides in the customer's codebase and therefore has an MIT license.</comments>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git@github.com:featurehub-io/featurehub-java-sdk.git</connection>
    <developerConnection>scm:git:git@github.com:featurehub-io/featurehub-java-sdk.git</developerConnection>
    <url>git@github.com:featurehub-io/featurehub-java-sdk.git</url>
    <tag>java-client-api-3.1</tag>
  </scm>

  <dependencies>
    <!-- because we are using kotlin now, lets use their annotations -->
    <dependency>
      <groupId>org.jetbrains</groupId>
      <artifactId>annotations</artifactId>
      <version>23.0.0</version>
    </dependency>

    <dependency>
      <groupId>jakarta.annotation</groupId>
      <artifactId>jakarta.annotation-api</artifactId>
      <version>2.0.0</version>
    </dependency>

    <dependency>
      <groupId>io.featurehub.sdk.composites</groupId>
      <artifactId>sdk-composite-jackson</artifactId>
      <version>[1.2,2)</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.openapitools</groupId>
        <artifactId>openapi-generator-maven-plugin</artifactId>
        <version>6.0.1</version>
        <dependencies>
          <dependency>
            <groupId>cd.connect.openapi</groupId>
            <artifactId>connect-openapi-jersey3</artifactId>
            <version>8.1</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>featurehub-api</id>
            <goals>
              <goal>generate</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <output>${project.basedir}/target/generated-sources/api</output>
              <apiPackage>io.featurehub.sse.api</apiPackage>
              <modelPackage>io.featurehub.sse.model</modelPackage>
              <inputSpec>${project.basedir}/edge-api.yaml</inputSpec>
              <generatorName>jersey3-api</generatorName>
              <generateApis>false</generateApis>
              <additionalProperties>
                <additionalProperty>useBeanValidation=false</additionalProperty>
                <additionalProperty>openApiNullable=false</additionalProperty>
                <additionalProperty>useNullForUnknownEnumValue=true</additionalProperty>
              </additionalProperties>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-generated-source</id>
            <phase>initialize</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-sources/api/src/gen</source>
              </sources>
            </configuration>
          </execution>
          <!-- publish the API at packaging time -->
          <execution>
            <id>attach-final-yaml</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${project.basedir}/edge-api.yaml</file>
                  <type>yaml</type>
                  <classifier>api</classifier>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>io.repaint.maven</groupId>
        <artifactId>tiles-maven-plugin</artifactId>
        <version>2.23</version>
        <extensions>true</extensions>
        <configuration>
          <filtering>false</filtering>
          <tiles>
            <tile>io.featurehub.sdk.tiles:tile-java8:[1.1,2)</tile>
            <tile>io.featurehub.sdk.tiles:tile-release:[1.1,2)</tile>
          </tiles>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
