<?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>cashu-voucher</artifactId>
        <version>0.15.0</version>
    </parent>

    <artifactId>cashu-voucher-domain</artifactId>
    <packaging>jar</packaging>

    <name>Cashu Voucher Domain</name>
    <description>Pure domain logic for gift card vouchers (zero infrastructure dependencies)</description>

    <dependencies>
        <!-- Cashu core entities -->
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>cashu-lib-entities</artifactId>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>cashu-lib-common</artifactId>
        </dependency>
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>cashu-lib-crypto</artifactId>
        </dependency>

        <!-- Crypto -->
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk18on</artifactId>
        </dependency>

        <!-- Nostr Schnorr signatures (secp256k1) -->
        <dependency>
            <groupId>xyz.tcheeric</groupId>
            <artifactId>nostr-java-core</artifactId>
        </dependency>

        <!-- Jackson for CBOR serialization -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-cbor</artifactId>
        </dependency>

        <!-- Utilities -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <!-- Testing -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- JMH Benchmarking -->
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-core</artifactId>
            <version>1.37</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-generator-annprocess</artifactId>
            <version>1.37</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Maven Shade Plugin for JMH benchmarks.
                 It must not rewrite the published pom, and that is what
                 `createDependencyReducedPom` is for here.

                 That option defaults to TRUE, so shade used to replace this module's
                 published pom with one declaring no compile dependencies at all: no
                 cashu-lib-common, no nostr-java-core, no Jackson. The shaded output is
                 `benchmarks.jar`, a separate finalName, so nothing was actually bundled into
                 the published artifact and the dependencies were simply lost.

                 The effect was invisible in-repo, because the reactor and imani-bom supply
                 those dependencies anyway, and broke any consumer resolving the artifact on
                 its own: a compile failure on `VoucherSecret`, which is in this module's
                 public API, or a NoClassDefFoundError on nostr's Schnorr the first time a
                 voucher signature is verified. Every release from 0.12.0 to 0.15.0 shipped
                 that way. See #50.

                 Building the benchmark jar on every `package` is still wasteful, but moving
                 it behind a profile changes how benchmarks are run, so that is left alone
                 here deliberately: this change is about what gets PUBLISHED. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.5.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <finalName>benchmarks</finalName>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>org.openjdk.jmh.Main</mainClass>
                                </transformer>
                            </transformers>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>maven-398ja-xyz</id>
            <name>398ja Maven Repository</name>
            <url>https://maven.398ja.xyz/releases</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>maven-398ja-xyz-snapshots</id>
            <name>398ja Maven Snapshots Repository</name>
            <url>https://maven.398ja.xyz/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <distributionManagement>
        <repository>
            <id>reposilite-releases</id>
            <name>398ja Maven Releases Repository</name>
            <url>https://maven.398ja.xyz/releases</url>
        </repository>
        <snapshotRepository>
            <id>reposilite-snapshots</id>
            <name>398ja Maven Snapshots Repository</name>
            <url>https://maven.398ja.xyz/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

</project>
