<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ Copyright (c) 2010-2026. AxonIQ B.V.
  ~
  ~ Licensed under the AXONIQ TERMS OF SERVICE,
  ~ Version 29 April 2026 (the "License");
  ~
  ~ The software is available for evaluation use without registration.
  ~ Continued use beyond the evaluation period requires registration
  ~ and a commercial license. See the License for the specific language
  ~ governing permissions and limitations under the License.
  ~ You may not use this file except in compliance with the License.
  ~
  ~ You may obtain a copy of the License at:
  ~  https://www.axoniq.io/legal/terms-of-service
  ~
  ~ For licensing information and to register, visit:
  ~  https://www.axoniq.io/pricing
  -->

<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>io.axoniq.framework</groupId>
        <artifactId>axoniq-data-protection-parent</artifactId>
        <version>5.4.0</version>
    </parent>

    <artifactId>axoniq-data-protection</artifactId>

    <name>Axoniq Framework - Data Protection</name>
    <description>
        Module providing cryptographic data protection and GDPR compliance through
        field-level encryption, key management, and the Right to be Forgotten implementation.
    </description>

    <dependencies>
        <!-- Entitlement -->
        <dependency>
            <groupId>io.axoniq.license</groupId>
            <artifactId>entitlement-manager</artifactId>
            <version>${entitlement-manager.version}</version>
        </dependency>
        <!-- Axon Framework -->
        <dependency>
            <groupId>org.axonframework</groupId>
            <artifactId>axon-messaging</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.axonframework</groupId>
            <artifactId>axon-eventsourcing</artifactId>
            <optional>true</optional>
        </dependency>
        <!-- Persistence -->
        <dependency>
            <groupId>jakarta.persistence</groupId>
            <artifactId>jakarta.persistence-api</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Crypto & Key Management -->
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp-jvm</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Scala (optional - for Scala support) -->
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>3.10.0</version>
            <optional>true</optional>
        </dependency>

        <!-- Internal Dependencies (will be shaded) -->
        <dependency>
            <groupId>org.jspecify</groupId>
            <artifactId>jspecify</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.google.code.findbugs</groupId>
                    <artifactId>jsr305</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.errorprone</groupId>
                    <artifactId>error_prone_annotations</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.j2objc</groupId>
                    <artifactId>j2objc-annotations</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>animal-sniffer-annotations</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>
        <dependency>
            <groupId>com.googlecode.gentyref</groupId>
            <artifactId>gentyref</artifactId>
        </dependency>

        <!-- Lombok (compile-time only) -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Test Dependencies -->
        <dependency>
            <groupId>org.axonframework</groupId>
            <artifactId>axon-messaging</artifactId>
            <classifier>tests</classifier>
            <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>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.fluttercode.datafactory</groupId>
            <artifactId>datafactory</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>uk.org.webcompere</groupId>
            <artifactId>system-stubs-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.bettercloud</groupId>
            <artifactId>vault-java-driver</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers-junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers-vault</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <extensions>
            <!-- Resolves ${os.detected.classifier} for protobuf plugin -->
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>${os-maven-plugin.version}</version>
            </extension>
        </extensions>

        <plugins>
            <!-- Scala compilation (for package.scala with type aliases) -->
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>4.10.0</version>
                <executions>
                    <execution>
                        <id>scala-compile-first</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>add-source</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <scalaVersion>3.8.3</scalaVersion>
                    <recompileMode>incremental</recompileMode>
                    <javacArgs>
                        <javacArg>-processorpath</javacArg>
                        <javacArg>${settings.localRepository}/org/projectlombok/lombok/${lombok.version}/lombok-${lombok.version}.jar</javacArg>
                    </javacArgs>
                </configuration>
            </plugin>

            <!-- Protobuf compilation -->
            <plugin>
                <groupId>org.xolstice.maven.plugins</groupId>
                <artifactId>protobuf-maven-plugin</artifactId>
                <version>${protobuf-maven-plugin.version}</version>
                <configuration>
                    <protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Lombok annotation processing -->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>

            <!-- Shade plugin to relocate dependencies and avoid conflicts -->
            <plugin>
                <artifactId>maven-shade-plugin</artifactId>
                <configuration>
                    <artifactSet>
                        <includes>
                            <include>com.google.guava:guava</include>
                            <include>com.google.protobuf:protobuf-java</include>
                            <include>com.googlecode.gentyref:gentyref</include>
                            <include>com.google.code.gson:gson</include>
                        </includes>
                    </artifactSet>
                    <relocations>
                        <relocation>
                            <pattern>com.google</pattern>
                            <shadedPattern>io.axoniq.framework.dataprotection.internal.shaded.com.google</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>google.protobuf</pattern>
                            <shadedPattern>io.axoniq.framework.dataprotection.internal.shaded.google.protobuf</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>com.googlecode</pattern>
                            <shadedPattern>io.axoniq.framework.dataprotection.internal.shaded.com.googlecode</shadedPattern>
                        </relocation>
                    </relocations>
                    <createDependencyReducedPom>false</createDependencyReducedPom>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- JAR plugin configuration -->
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                    </archive>
                </configuration>
            </plugin>

            <!-- JavaDoc plugin - creates javadoc JAR -->
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc.version}</version>
                <configuration>
                    <source>21</source>
                    <excludePackageNames>io.axoniq.framework.dataprotection.internal</excludePackageNames>
                    <doclint>all,-missing</doclint>
                    <detectOfflineLinks>false</detectOfflineLinks>
                    <failOnError>false</failOnError>
                    <links>
                        <link>https://docs.oracle.com/en/java/javase/21/docs/api/</link>
                    </links>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
