<?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>
    <parent>
        <groupId>xyz.tcheeric</groupId>
        <artifactId>wallet-core</artifactId>
        <version>0.1.8</version>
    </parent>

    <!-- Backward compatibility: artifactId remains wallet-core -->
    <artifactId>wallet-core-app</artifactId>

    <name>Wallet Core - Application</name>
    <description>Assembled wallet-core module (all layers combined)</description>

    <dependencies>
        <!-- Depend on all wallet-core modules -->
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>wallet-core-base</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>wallet-core-observability</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>wallet-core-cashu</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>wallet-core-nostr</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- Identity plugin (for signing and encryption) - Task 6.1.10, 6.1.11 -->
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>identity-api</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>identity-application</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!-- Provides InProcessMessageBus implementation (MessageClient impl) -->
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>identity-infrastructure</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!-- Identity plugin messaging contracts -->
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>messaging-contracts</artifactId>
        </dependency>

        <!-- Additional dependencies not covered by modules -->
        <dependency>
            <groupId>de.mkammerer</groupId>
            <artifactId>argon2-jvm</artifactId>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk18on</artifactId>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>cashu-wallet-client</artifactId>
        </dependency>

        <!-- Cashu Voucher Library (Task 4 Phase 1) -->
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>cashu-voucher-domain</artifactId>
            <version>${cashu-voucher.version}</version>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>cashu-voucher-nostr</artifactId>
            <version>${cashu-voucher.version}</version>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>cashu-voucher-app</artifactId>
            <version>${cashu-voucher.version}</version>
            <!-- Exclude bcprov-jdk15to18:1.80 (transitively via cashu-lib-common
                 → bip-utils → bitcoinj-core); it conflicts with bcprov-jdk18on:1.81
                 from imani-bom and the two distributions have incompatible ChaCha20
                 cipher init APIs. See
                 docs/status-spec-012-016-staging-2026-05-10.md §1. -->
            <exclusions>
                <exclusion>
                    <groupId>org.bouncycastle</groupId>
                    <artifactId>bcprov-jdk15to18</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>cashu-wallet-protocol</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>jakarta.el</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>io.github.resilience4j</groupId>
            <artifactId>resilience4j-circuitbreaker</artifactId>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-exporter-otlp</artifactId>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-sdk-extension-autoconfigure</artifactId>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-semconv</artifactId>
            <version>${opentelemetry-semconv.version}</version>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
        </dependency>
        <dependency>
            <groupId>io.undertow</groupId>
            <artifactId>undertow-core</artifactId>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>nostr-java-core</artifactId>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>nostr-java-identity</artifactId>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>wallet-core-nostr</artifactId>
            <version>${project.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </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>net.jqwik</groupId>
            <artifactId>jqwik</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>phoenixd-rest</artifactId>
            <version>${phoenixd-rest.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <testResources>
            <testResource>
                <directory>${project.basedir}/src/test/resources</directory>
            </testResource>
            <testResource>
                <directory>${project.basedir}/../../../fixtures/localstack</directory>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
                <configuration>
                    <reuseForks>true</reuseForks>
                    <forkCount>1</forkCount>
                    <parallel>classes</parallel>
                    <threadCount>2</threadCount>
                    <systemPropertyVariables>
                        <testcontainers.reuse.enable>true</testcontainers.reuse.enable>
                        <noDocker>true</noDocker>
                        <wallet.db.pool.registerMbeans>false</wallet.db.pool.registerMbeans>
                        <wallet.db.pool.uniqueName>true</wallet.db.pool.uniqueName>
                        <jna.nosys>true</jna.nosys>
                        <jna.tmpdir>/tmp</jna.tmpdir>
                        <WALLET_HOME>/tmp/.imani-bridge-tests</WALLET_HOME>
                        <CASHU_HOME>/tmp/.imani-bridge-tests</CASHU_HOME>
                    </systemPropertyVariables>
                    <environmentVariables>
                        <WALLET_HOME>/tmp/.imani-bridge-tests</WALLET_HOME>
                        <CASHU_HOME>/tmp/.imani-bridge-tests</CASHU_HOME>
                        <noDocker>true</noDocker>
                        <JNA_NOSYS>true</JNA_NOSYS>
                        <JNA_TEMPDIR>/tmp</JNA_TEMPDIR>
                    </environmentVariables>
                    <includes>
                        <include>**/*Test.java</include>
                    </includes>
                    <excludes>
                        <exclude>**/*IT.java</exclude>
                        <exclude>**/*ITCase.java</exclude>
                        <exclude>**/*IntegrationTest.java</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${maven.failsafe.plugin.version}</version>
                <configuration>
                    <!-- Uses skipITs.wallet from parent profiles -->
                    <skipITs>${skipITs.wallet}</skipITs>
                    <includes>
                        <include>**/*IT.java</include>
                        <include>**/*ITCase.java</include>
                        <include>**/*IntegrationTest.java</include>
                    </includes>
                    <!-- Uses it.groups from parent profiles if set -->
                    <groups>${it.groups}</groups>
                    <systemPropertyVariables>
                        <testcontainers.reuse.enable>true</testcontainers.reuse.enable>
                        <wallet.relay.circuitBreaker.failureRateThreshold>25</wallet.relay.circuitBreaker.failureRateThreshold>
                        <wallet.relay.circuitBreaker.windowType>COUNT</wallet.relay.circuitBreaker.windowType>
                        <wallet.relay.circuitBreaker.windowSize>4</wallet.relay.circuitBreaker.windowSize>
                        <wallet.relay.circuitBreaker.minimumCalls>2</wallet.relay.circuitBreaker.minimumCalls>
                        <wallet.relay.circuitBreaker.openWaitMs>200</wallet.relay.circuitBreaker.openWaitMs>
                        <wallet.relay.circuitBreaker.permittedHalfOpen>1</wallet.relay.circuitBreaker.permittedHalfOpen>
                        <WALLET_TRACING_ENABLED>true</WALLET_TRACING_ENABLED>
                        <WALLET_METRICS_ENABLED>true</WALLET_METRICS_ENABLED>
                    </systemPropertyVariables>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <!--
         Integration test execution is controlled by parent profile properties.
         Use: mvn verify -Pit-wallet-app (wallet app integration tests)
         Use: mvn verify -Pit-wallet-app-mint (wallet app integration tests requiring mint)
         Use: mvn verify -Pit-wallet (all wallet integration tests)
         Use: mvn verify -Pit-all (all integration tests across repository)

         Failsafe plugin is configured in build section for consistent inclusion,
         skip behavior is controlled via skipITs.wallet property from parent.
    -->

</project>
