<?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-atomic</artifactId>
    <version>0.1.2</version>
    <packaging>pom</packaging>
    <name>Imani Gateway Atomic Operations</name>
    <description>Atomic Operations Service for atomic purchase, atomic send, cash payment, escrow, webhook, and payment controllers — standalone project extracted from imani-bridge</description>

    <modules>
        <module>gateway-atomic-rest</module>
        <module>gateway-atomic-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.44</imani-bom.version>
        <imani-gateway-api.version>0.1.1-SNAPSHOT</imani-gateway-api.version>

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

        <!-- 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>
    </properties>

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

            <!-- Gateway API (DTOs + ports) -->
            <!-- Deliberately pinned, overriding imani-bom. AtomicPurchaseService
                 implements AtomicPurchasePort as it stood in 0.1.1-SNAPSHOT. Every
                 published gateway-api (0.4.0, 0.5.2, 0.6.0) adds
                 clientMaterialized(purchaseId, ClientMaterializedRequest, idempotencyKey),
                 which this service does not implement, so the module will not compile
                 against any of them.

                 Two things make this pin fragile and worth removing rather than keeping:
                 0.1.1-SNAPSHOT resolves from the local ~/.m2 only (404 on the remote
                 repository), so this module builds on a developer machine that happens to
                 have it and nowhere else; and a snapshot in a release build is not
                 reproducible. The fix is to implement the clientMaterialized saga step and
                 drop this block so the version comes from the BOM like everything else. -->
            <dependency>
                <groupId>xyz.tcheeric</groupId>
                <artifactId>imani-gateway-api</artifactId>
                <version>${imani-gateway-api.version}</version>
            </dependency>

            <!-- imani-security is managed by imani-bom above (0.1.3). It was pinned here
                 to 0.1.0, which silently overrode the BOM. This service uses DigestPool
                 rather than Nip98AuthFilter, so the read-auth change does not reach it. -->


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

    <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>

    <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>
        </repository>
        <repository>
            <id>reposilite-snapshots</id>
            <url>https://maven.398ja.xyz/snapshots</url>
        </repository>
    </repositories>

    <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>

</project>
