<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>xyz.tcheeric</groupId>
    <artifactId>imani-gateway-core</artifactId>
    <version>0.6.7</version>
    <packaging>pom</packaging>
    <name>Imani Gateway Core</name>
    <description>Gateway Core service for account management, authentication, identity resolution, and platform concerns — standalone project extracted from imani-bridge</description>

    <modules>
        <module>gateway-core-rest</module>
        <module>gateway-core-it</module>
    </modules>

    <properties>
        <java.version>21</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <imani-bom.version>0.1.23</imani-bom.version>
        <imani-commons.version>0.1.0</imani-commons.version>
        <imani-identity.version>0.1.0</imani-identity.version>
        <imani-gateway-api.version>0.1.7</imani-gateway-api.version>
        <imani-security.version>0.1.0</imani-security.version>
        <imani-nostrdb.version>0.1.2</imani-nostrdb.version>
        <nap-java.version>0.1.1</nap-java.version>

        <!-- Spec 014 (payment receipts): receipts package added in 0.2.0;
             gateway-core-rest consumes PaymentReceiptIssuedEvent /
             PaymentReceiptDelivery / PaymentReceiptAck records. Bump
             to track the messaging-contracts release that ships those
             records (currently scaffolded in 014 T001). -->
        <messaging-contracts.version>0.2.0</messaging-contracts.version>

        <!-- Integration Test Defaults -->
        <skipITs>true</skipITs>
        <skipITs.core>true</skipITs.core>

        <!-- Build Plugin Versions -->
        <maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
        <maven.surefire.plugin.version>3.5.2</maven.surefire.plugin.version>
        <maven.failsafe.plugin.version>3.2.5</maven.failsafe.plugin.version>
        <spring-boot-maven-plugin.version>3.5.5</spring-boot-maven-plugin.version>
        <jib-maven-plugin.version>3.4.0</jib-maven-plugin.version>

        <!-- Observability -->
        <micrometer-tracing.version>1.4.4</micrometer-tracing.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>imani-bom</artifactId>
                <version>${imani-bom.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Identity modules -->
            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>imani-commons</artifactId>
                <version>${imani-commons.version}</version>
            </dependency>

            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>identity-api</artifactId>
                <version>${imani-identity.version}</version>
            </dependency>
            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>identity-domain</artifactId>
                <version>${imani-identity.version}</version>
            </dependency>
            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>identity-application</artifactId>
                <version>${imani-identity.version}</version>
            </dependency>
            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>identity-infrastructure</artifactId>
                <version>${imani-identity.version}</version>
            </dependency>

            <!-- Gateway API (DTOs + ports) -->
            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>imani-gateway-api</artifactId>
                <version>${imani-gateway-api.version}</version>
            </dependency>

            <!-- Security (auth filters) -->
            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>imani-security</artifactId>
                <version>${imani-security.version}</version>
            </dependency>

            <!-- Nostrdb -->
            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>imani-nostrdb</artifactId>
                <version>${imani-nostrdb.version}</version>
            </dependency>

            <!-- NAP Java (Nostr Authentication Protocol) -->
            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>nap-core</artifactId>
                <version>${nap-java.version}</version>
            </dependency>
            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>nap-server</artifactId>
                <version>${nap-java.version}</version>
            </dependency>
            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>nap-jdbc</artifactId>
                <version>${nap-java.version}</version>
            </dependency>
            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>nap-spring</artifactId>
                <version>${nap-java.version}</version>
            </dependency>

            <!-- Spec 014 (payment receipts) — JMS message contracts -->
            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>messaging-contracts</artifactId>
                <version>${messaging-contracts.version}</version>
            </dependency>

            <!-- Internal modules -->
            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>gateway-core-rest</artifactId>
                <version>${project.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven.compiler.plugin.version}</version>
                    <configuration>
                        <parameters>true</parameters>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire.plugin.version}</version>
                    <configuration>
                        <useModulePath>false</useModulePath>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven.failsafe.plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <distributionManagement>
        <repository>
            <id>reposilite-releases</id>
            <url>https://maven.398ja.xyz/releases</url>
        </repository>
        <snapshotRepository>
            <id>reposilite-snapshots</id>
            <url>https://maven.398ja.xyz/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <!--
        Resolution sources. Without these declared at the project level
        Maven only knows about Maven Central, and dependencies on
        xyz.tcheeric:* (imani-bom, imani-commons, imani-security,
        messaging-contracts, …) fail to resolve in CI environments
        that don't have a host-side ~/.m2/settings.xml mirror entry.

        Mirrors the pattern in messaging-contracts/pom.xml so the two
        repos resolve dependencies the same way.
    -->
    <repositories>
        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <releases><enabled>true</enabled></releases>
            <snapshots><enabled>false</enabled></snapshots>
        </repository>
        <repository>
            <id>reposilite-releases</id>
            <url>https://maven.398ja.xyz/releases</url>
            <releases><enabled>true</enabled></releases>
            <snapshots><enabled>false</enabled></snapshots>
        </repository>
        <repository>
            <id>reposilite-snapshots</id>
            <url>https://maven.398ja.xyz/snapshots</url>
            <releases><enabled>false</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </repository>
    </repositories>

</project>
