<?xml version="1.0" encoding="UTF-8"?>

<!--
  #%L
  Pollen :: Rest Api
  %%
  Copyright (C) 2009 - 2026 Code Lutin
  %%
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.
  
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
  
  You should have received a copy of the GNU Affero General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  #L%
  -->

<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>org.chorem</groupId>
        <artifactId>pollen</artifactId>
        <version>3.5.4-SNAPSHOT</version>
    </parent>

    <groupId>org.chorem.pollen</groupId>
    <artifactId>pollen-rest-api</artifactId>
    <packaging>jar</packaging>

    <name>Pollen :: Rest Api</name>
    <description>Pollen Rest Api</description>

    <properties>

        <i18n.silent>true</i18n.silent>
        <i18n.bundleOutputName>${pollenI18nBundle}</i18n.bundleOutputName>

        <quarkus.package.jar.type>uber-jar</quarkus.package.jar.type>
        <quarkus.package.jar.add-runner-suffix>false</quarkus.package.jar.add-runner-suffix>
    </properties>

    <dependencies>

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>pollen-votecounting</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>pollen-persistence</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>pollen-services</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-core</artifactId>
        </dependency>

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-rest</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-rest-jackson</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>io.quarkus.resteasy.reactive</groupId>
            <artifactId>resteasy-reactive</artifactId>
        </dependency>

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-quartz</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-smallrye-health</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.eclipse.microprofile.health</groupId>
            <artifactId>microprofile-health-api</artifactId>
        </dependency>

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-opentelemetry</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.hibernate.orm</groupId>
            <artifactId>hibernate-core</artifactId>
        </dependency>

        <dependency>
            <groupId>jakarta.ws.rs</groupId>
            <artifactId>jakarta.ws.rs-api</artifactId>
        </dependency>

        <dependency>
            <groupId>jakarta.inject</groupId>
            <artifactId>jakarta.inject-api</artifactId>
        </dependency>

        <dependency>
            <groupId>jakarta.enterprise</groupId>
            <artifactId>jakarta.enterprise.cdi-api</artifactId>
        </dependency>

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

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
        </dependency>

        <dependency>
            <groupId>org.nuiton.i18n</groupId>
            <artifactId>nuiton-i18n</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.github.classgraph</groupId>
            <artifactId>classgraph</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.slf4j</groupId>
            <artifactId>slf4j-jboss-logmanager</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>

        <dependency>
            <groupId>org.nuiton</groupId>
            <artifactId>nuiton-utils</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>

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

        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.eclipse.microprofile.config</groupId>
            <artifactId>microprofile-config-api</artifactId>
            <scope>test</scope>
        </dependency>

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

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-junit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>fluent-hc</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.jpg</include>
                    <include>**/*.yaml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.nuiton.i18n</groupId>
                <artifactId>i18n-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>bundle</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>io.github.git-commit-id</groupId>
                <artifactId>git-commit-id-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>get-the-git-infos</id>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                        <phase>initialize</phase>
                    </execution>
                </executions>
                <configuration>
                    <verbose>false</verbose>
                    <includeOnlyProperties>
                        <includeOnlyProperty>^git.commit.id.describe$</includeOnlyProperty>
                    </includeOnlyProperties>
                    <commitIdGenerationMode>full</commitIdGenerationMode>
                </configuration>
            </plugin>

            <plugin>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-maven-plugin</artifactId>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <goals>
                            <goal>build</goal>
                            <goal>generate-code</goal>
                            <goal>generate-code-tests</goal>
                            <goal>native-image-agent</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                        <maven.home>${maven.home}</maven.home>
                    </systemPropertyVariables>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>${openapi-generator-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${project.basedir}/src/main/resources/openapi/v2.yaml</inputSpec>
                            <generatorName>jaxrs-spec</generatorName>
                            <apiPackage>org.chorem.pollen.rest.api.v2.api</apiPackage>
                            <modelPackage>org.chorem.pollen.rest.api.v2.model</modelPackage>
                            <modelNameSuffix>Dto</modelNameSuffix>
                            <configOptions>
                                <dateLibrary>java8</dateLibrary>
                                <interfaceOnly>true</interfaceOnly>
                                <library>quarkus</library>
                                <openApiNullable>false</openApiNullable>
                                <sourceFolder>src/main/java</sourceFolder>
                                <useBeanValidation>false</useBeanValidation>
                                <useJakartaEe>true</useJakartaEe>
                                <useSwaggerAnnotations>false</useSwaggerAnnotations>
                                <useTags>true</useTags>
                            </configOptions>
                            <schemaMappings>
                                <schemaMapping>UndefinedResponse=jakarta.ws.rs.core.Response</schemaMapping>
                                <schemaMapping>CommentId=org.chorem.pollen.services.bean.PollenEntityId&lt;org.chorem.pollen.persistence.entity.Comment&gt;</schemaMapping>
                                <schemaMapping>PollId=org.chorem.pollen.services.bean.PollenEntityId&lt;org.chorem.pollen.persistence.entity.Poll&gt;</schemaMapping>
                                <schemaMapping>UserId=org.chorem.pollen.services.bean.PollenEntityId&lt;org.chorem.pollen.persistence.entity.PollenUser&gt;</schemaMapping>
                                <schemaMapping>UserEmailAddressId=org.chorem.pollen.services.bean.PollenEntityId&lt;org.chorem.pollen.persistence.entity.PollenUserEmailAddress&gt;</schemaMapping>
                                <schemaMapping>FavoriteListId=org.chorem.pollen.services.bean.PollenEntityId&lt;org.chorem.pollen.persistence.entity.FavoriteList &gt;</schemaMapping>
                                <schemaMapping>ChildFavoriteListId=org.chorem.pollen.services.bean.PollenEntityId&lt;org.chorem.pollen.persistence.entity.ChildFavoriteList &gt;</schemaMapping>
                                <schemaMapping>FavoriteListMemberId=org.chorem.pollen.services.bean.PollenEntityId&lt;org.chorem.pollen.persistence.entity.FavoriteListMember &gt;</schemaMapping>
                                <schemaMapping>ResourceId=org.chorem.pollen.services.bean.PollenEntityId&lt;org.chorem.pollen.persistence.entity.PollenResource&gt;</schemaMapping>
                            </schemaMappings>
                            <typeMappings>
                                <typeMapping>string+CommentId=CommentId</typeMapping>
                                <typeMapping>string+PollId=PollId</typeMapping>
                                <typeMapping>string+ResourceId=ResourceId</typeMapping>
                                <typeMapping>string+UserId=UserId</typeMapping>
                                <typeMapping>string+UserEmailAddressId=UserEmailAddressId</typeMapping>
                                <typeMapping>string+FavoriteListId=FavoriteListId</typeMapping>
                                <typeMapping>string+ChildFavoriteListId=ChildFavoriteListId</typeMapping>
                                <typeMapping>string+FavoriteListMemberId=FavoriteListMemberId</typeMapping>
                                <typeMapping>file=jakarta.ws.rs.core.Response</typeMapping>
                            </typeMappings>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-openapi-contract</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>${project.build.directory}/classes/openapi/v2.yaml</file>
                                    <type>yaml</type>
                                    <classifier>openapi</classifier>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
