<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>xyz.tcheeric</groupId>
        <artifactId>cashu-mint</artifactId>
        <version>0.38.7</version>
    </parent>
    <artifactId>cashu-mint-rest-it</artifactId>
    <version>0.38.7</version>
    <name>cashu-mint-rest-it</name>
    <description>Integration tests for cashu-mint-rest</description>

    <properties>
        <java.version>21</java.version>
    </properties>

    <dependencies>
        <!-- Main module under test - compile scope needed to access main classes -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>cashu-mint-rest</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- Spring Boot Test -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Voucher dependencies for testing -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>cashu-voucher-domain</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>cashu-voucher-app</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>cashu-voucher-nostr</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Test database -->
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Spec 001 cashu-mint-jpa under test (durable mint quote / webhook tables) -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>cashu-mint-jpa</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- Testcontainers Postgres for spec 001 durable-path ITs -->
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Webhook module for integration testing -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>cashu-mint-webhook</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Use surefire for integration tests to avoid failsafe annotation processing bug -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skipTests>${skip.integration-tests}</skipTests>
                    <includes>
                        <include>**/*IT.java</include>
                        <include>**/*IntegrationTest.java</include>
                    </includes>
                    <!-- Override parent's exclude configuration -->
                    <excludes combine.self="override"/>
                </configuration>
            </plugin>

            <!--
              Failsafe must NOT also run these.

              The parent's integration-tests profile binds failsafe to
              **/*IT.java, and surefire above claims the same pattern in this
              module (see the comment on that plugin). Under `mvn verify` both
              fired, so every IT class ran TWICE against one shared Postgres —
              the second run colliding with rows the first had left mid-flight.

              That produced an intermittent MeltSagaReconcilerIT failure whose
              message pointed at a timeline assertion, and which moved between
              the surefire and failsafe report directories from run to run.
              Chasing it through the reports was misleading precisely because
              two different executions were writing two different answers.

              Skipping failsafe here leaves exactly one owner for this module.
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <skipITs>true</skipITs>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
