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

<!--
SPDX-FileCopyrightText: 2025 diggsweden/eudiw-wallet-token-lib

SPDX-License-Identifier: CC0-1.0
-->

<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>

  <groupId>se.digg.wallet</groupId>
  <artifactId>token-lib</artifactId>
  <version>0.9.1</version>

  <name>EUDI Wallet -- Token Library</name>
  <description>Library for handling data types in the EUDI Wallet PoC project.</description>
  <url>https://github.com/diggsweden/eudiw-wallet-token-lib</url>

  <licenses>
    <license>
      <name>European Union Public License 1.2</name>
      <url>https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:https://github.com/diggsweden/eudiw-wallet-token-lib.git</connection>
    <developerConnection>scm:git:https://github.com/diggsweden/eudiw-wallet-token-lib.git</developerConnection>
    <url>https://github.com/diggsweden/eudiw-wallet-token-lib</url>
    <tag>HEAD</tag>
  </scm>

  <organization>
    <name>Digg</name>
    <url>https://digg.se</url>
  </organization>

  <developers>
    <developer>
      <name>Stefan Santesson</name>
      <email>extern.stefan.santesson@digg.se</email>
      <organization>Digg - Agency for Digital Government</organization>
      <organizationUrl>https://www.digg.se</organizationUrl>
    </developer>
  </developers>

  <properties>
    <maven.compiler.source>21</maven.compiler.source>
    <maven.compiler.target>21</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <slf4j.version>2.0.17</slf4j.version>

    <!-- Dependency versions -->
    <slf4j.version>2.0.17</slf4j.version>
    <credentials-support.version>2.0.5</credentials-support.version>
    <jackson.version>2.18.3</jackson.version>
    <junit.version>5.12.1</junit.version>
    <mockito.version>5.17.0</mockito.version>
    <lombok.version>1.18.38</lombok.version>
    <bouncycastle.version>1.80</bouncycastle.version>
    <nimbus-jose.version>10.1</nimbus-jose.version>
    <jsonassert.version>1.5.3</jsonassert.version>

    <!-- Plugin versions -->
    <maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
    <maven.source.plugin.version>3.3.1</maven.source.plugin.version>
    <maven.compiler.plugin.version>3.14.0</maven.compiler.plugin.version>
    <maven.javadoc.plugin.version>3.11.2</maven.javadoc.plugin.version>
    <maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>
    <maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
    <maven.gpg.plugin.version>3.2.7</maven.gpg.plugin.version>
    <jreleaser-maven-plugin.version>1.17.0</jreleaser-maven-plugin.version>
    <formatter-maven-plugin.version>2.26.0</formatter-maven-plugin.version>
    <maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
    <checkstyle.version>10.23.0</checkstyle.version>
    <maven-enforcer-plugin.version>3.5.0</maven-enforcer-plugin.version>
  </properties>

  <!-- Dependencies -->
  <dependencies>
    <!-- Lombok -->
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>${lombok.version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- Jackson dependencies -->
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.dataformat</groupId>
      <artifactId>jackson-dataformat-cbor</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.datatype</groupId>
      <artifactId>jackson-datatype-jsr310</artifactId>
      <version>${jackson.version}</version>
    </dependency>

    <!-- Cryptography -->
    <dependency>
      <groupId>org.bouncycastle</groupId>
      <artifactId>bcprov-jdk18on</artifactId>
      <version>${bouncycastle.version}</version>
    </dependency>

    <!-- Security Support -->
    <dependency>
      <groupId>se.swedenconnect.security</groupId>
      <artifactId>credentials-support</artifactId>
      <version>${credentials-support.version}</version>
    </dependency>

    <dependency>
      <groupId>se.digg.cose</groupId>
      <artifactId>cose-lib</artifactId>
      <version>2.0.0</version>
    </dependency>

    <!-- Logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
    </dependency>

    <!-- JWT Support -->
    <dependency>
      <groupId>com.nimbusds</groupId>
      <artifactId>nimbus-jose-jwt</artifactId>
      <version>${nimbus-jose.version}</version>
    </dependency>

    <!-- Test dependencies -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>${slf4j.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>${mockito.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-junit-jupiter</artifactId>
      <version>${mockito.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.skyscreamer</groupId>
      <artifactId>jsonassert</artifactId>
      <version>${jsonassert.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <!-- Build configuration -->
  <build>
    <plugins>
      <!-- Enforcer Plugin for Maven and Java version requirements -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>${maven-enforcer-plugin.version}</version>
        <executions>
          <execution>
            <id>enforce-maven</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>[3.8.0,)</version>
                </requireMavenVersion>
                <requireJavaVersion>
                  <version>[21,)</version>
                </requireJavaVersion>
                <!-- <dependencyConvergence/>-->
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Maven Compiler Plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <configuration>
          <source>${maven.compiler.source}</source>
          <target>${maven.compiler.target}</target>
        </configuration>
      </plugin>

      <!-- Formatter plugin -->
      <plugin>
        <groupId>net.revelc.code.formatter</groupId>
        <artifactId>formatter-maven-plugin</artifactId>
        <version>${formatter-maven-plugin.version}</version>
        <configuration>
          <configFile>${project.basedir}/development/format/eclipse-java-google-style.xml</configFile>
          <lineEnding>LF</lineEnding>
          <compilerSource>${maven.compiler.source}</compilerSource>
          <compilerCompliance>${maven.compiler.source}</compilerCompliance>
          <compilerTargetPlatform>${maven.compiler.target}</compilerTargetPlatform>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>format</goal>
            </goals>
            <phase>verify</phase>
          </execution>
        </executions>
      </plugin>

      <!-- Checkstyle plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven-checkstyle-plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>${checkstyle.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <configLocation>${project.basedir}/development/lint/google_checks.xml</configLocation>
          <consoleOutput>true</consoleOutput>
          <failsOnError>true</failsOnError>
          <linkXRef>false</linkXRef>
        </configuration>
        <executions>
          <execution>
            <id>validate</id>
            <phase>validate</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Maven Surefire Plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin.version}</version>
        <configuration>
          <forkCount>1</forkCount>
          <reuseForks>false</reuseForks>
        </configuration>
      </plugin>

      <!-- Deployment -->
      <plugin>
        <groupId>org.sonatype.central</groupId>
        <artifactId>central-publishing-maven-plugin</artifactId>
        <version>0.7.0</version>
        <extensions>true</extensions>
        <configuration>
          <checksums>all</checksums>
          <skipPublishing>false</skipPublishing>
          <publishingServerId>central</publishingServerId>
        </configuration>
      </plugin>

      <!-- JReleaser -->
      <plugin>
        <groupId>org.jreleaser</groupId>
        <artifactId>jreleaser-maven-plugin</artifactId>
        <version>${jreleaser-maven-plugin.version}</version>
        <configuration>
          <configFile>${project.basedir}/jreleaser.yml</configFile>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>central-release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven.gpg.plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- Sources -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${maven.source.plugin.version}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- Documentation -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${maven.javadoc.plugin.version}</version>
            <configuration>
              <source>${maven.target.source}</source>
              <bottom>COSE for Java documentation, generated in {currentYear}.</bottom>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <!-- Repositories -->
  <repositories>
    <repository>
      <id>central-portal-snapshots</id>
      <name>Central Portal Snapshots</name>
      <url>https://central.sonatype.com/repository/maven-snapshots/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

</project>