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

    Copyright © 2015 The Gravitee team (http://gravitee.io)

    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:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>io.gravitee.gamma</groupId>
        <artifactId>gravitee-gamma</artifactId>
        <version>4.12.6</version>
    </parent>

    <groupId>io.gravitee.gamma.module</groupId>
    <artifactId>gravitee-gamma-module-platform</artifactId>
    <name>Gravitee.io Gamma - Module - Platform</name>
    <description>Platform module for Gravitee Gamma</description>

    <properties>
        <skip.ui.build>false</skip.ui.build>
        <gravitee-am-management-api-sdk-java.version>4.12.0-alpha.4</gravitee-am-management-api-sdk-java.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.gravitee.apim</groupId>
                <artifactId>gravitee-apim-bom</artifactId>
                <version>${project.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>io.gravitee.gamma.plugin.module</groupId>
            <artifactId>gravitee-gamma-plugin-module-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>io.gravitee.apim.common</groupId>
            <artifactId>gravitee-apim-common</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-servlet</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-mongodb</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-sync</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- AM connection persistence + token encryption live in APIM rest-api core. -->
        <dependency>
            <groupId>io.gravitee.apim.rest.api</groupId>
            <artifactId>gravitee-apim-rest-api-service</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.gravitee.apim.rest.api</groupId>
            <artifactId>gravitee-apim-rest-api-model</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- @Permission/@Permissions annotations enforced by the rest-api PermissionsFilter. -->
        <dependency>
            <groupId>io.gravitee.apim.rest.api</groupId>
            <artifactId>gravitee-apim-rest-api-rest</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.gravitee.apim.repository</groupId>
            <artifactId>gravitee-apim-repository-api</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.gravitee.common</groupId>
            <artifactId>gravitee-common</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- JAX-RS / validation / DI (versions managed by gravitee-apim-bom) -->
        <dependency>
            <groupId>jakarta.ws.rs</groupId>
            <artifactId>jakarta.ws.rs-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.inject</groupId>
            <artifactId>jakarta.inject-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.ext</groupId>
            <artifactId>jersey-bean-validation</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Vert.x backs the AM SDK's async HTTP client. -->
        <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-web-client</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- AM management SDK (backs the AM connection test + directory lookups, bundled into the plugin zip). -->
        <dependency>
            <groupId>io.gravitee.am</groupId>
            <artifactId>gravitee-am-management-api-sdk-java</artifactId>
            <version>${gravitee-am-management-api-sdk-java.version}</version>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <!-- Architecture tests — enforce use cases stay independent (AGENTS.md §3). -->
            <groupId>com.tngtech.archunit</groupId>
            <artifactId>archunit-junit5</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>nx-build</id>
                        <phase>generate-resources</phase>
                        <goals><goal>exec</goal></goals>
                        <configuration>
                            <executable>yarn</executable>
                            <workingDirectory>${project.basedir}/../..</workingDirectory>
                            <environmentVariables>
                                <NX_DAEMON>false</NX_DAEMON>
                                <NODE_OPTIONS>--max-old-space-size=4096</NODE_OPTIONS>
                                <NX_CACHE_DIRECTORY>${project.build.directory}/.nx/cache</NX_CACHE_DIRECTORY>
                            </environmentVariables>
                            <arguments>
                                <argument>nx</argument>
                                <argument>build</argument>
                                <argument>gravitee-gamma-module-platform</argument>
                            </arguments>
                            <skip>${skip.ui.build}</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>make-plugin-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>src/main/assembly/plugin-assembly.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
