<?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.2.0</version>
    </parent>

    <artifactId>wallet-core-nostr</artifactId>

    <name>Wallet Core - Nostr</name>
    <description>Nostr relay client and messaging (uses identity-plugin)</description>

    <dependencies>
        <!-- Depend on base and observability -->
        <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>

        <!-- Identity plugin messaging - Task 5b.1 -->
        <!-- MessageClient interface and message types (SignEventRequest, EncryptMessageRequest, etc.) -->
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>messaging-contracts</artifactId>
        </dependency>

        <!-- Identity plugin (for signing and encryption) - Task 5.1.8, 5.1.9, 5b.1 -->
        <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>

        <!-- Nostr libraries - Task 5.1.10, 5.1.11, 5.1.12 -->
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>nostr-java-event</artifactId>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>nostr-java-client</artifactId>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>nostr-java-core</artifactId>
        </dependency>

        <!-- Cashu Voucher Library (Task 4 Phase 2) -->
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>cashu-voucher-domain</artifactId>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>cashu-voucher-nostr</artifactId>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>cashu-voucher-app</artifactId>
            <!-- 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>

        <!-- Caffeine cache for thread-safe bounded caching -->
        <dependency>
            <groupId>com.github.ben-manes.caffeine</groupId>
            <artifactId>caffeine</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.google.errorprone</groupId>
                    <artifactId>error_prone_annotations</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</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>
            <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>net.jqwik</groupId>
            <artifactId>jqwik</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- Jakarta Validation - runtime needed for validation tests -->
        <dependency>
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>jakarta.el</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- Logback for tests (avoiding configuration issues) -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <testResources>
            <testResource>
                <directory>${project.basedir}/src/test/resources</directory>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
                <configuration>
                    <systemPropertyVariables>
                        <!-- Allow JNA (Argon2) to unload native library within the sandbox -->
                        <jna.tmpdir>${project.build.directory}</jna.tmpdir>
                    </systemPropertyVariables>
                    <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-jar-plugin</artifactId>
                <version>${maven.jar.plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </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>
                        <jna.tmpdir>${project.build.directory}</jna.tmpdir>
                        <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_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>
                    </environmentVariables>
                </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-nostr (wallet nostr integration tests)
         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>
