<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>lu.vigasoft</groupId>
    <artifactId>bizzlink-sdk-java</artifactId>
    <version>0.3.1</version>
    <packaging>jar</packaging>

    <name>Bizzlink Java SDK</name>
    <description>Official Java client library for the Bizzlink e-Invoicing Infrastructur API.</description>
    <url>https://docs.bizzlink.lu</url>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
    </licenses>

    <organization>
        <name>Vigasoft S.à r.l.-S.</name>
        <url>https://www.vigasoft.lu</url>
    </organization>

    <developers>
        <developer>
            <id>luc</id>
            <name>Luc Vigato</name>
            <email>luc@vigasoft.lu</email>
            <organization>Vigasoft S.à r.l.-S.</organization>
            <organizationUrl>https://www.vigasoft.lu</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://docs.bizzlink.lu</connection>
        <developerConnection>scm:git:https://docs.bizzlink.lu</developerConnection>
        <url>https://docs.bizzlink.lu</url>
    </scm>


    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.release>25</maven.compiler.release>

        <jackson.version>3.1.3</jackson.version>
        <jspecify.version>1.0.0</jspecify.version>
        <slf4j.version>2.0.16</slf4j.version>

        <junit.version>6.0.3</junit.version>
        <mockito.version>5.13.0</mockito.version>

        <openapi.generator.version>7.22.0</openapi.generator.version>
        <openapi.spec>${project.basedir}/src/main/openapi/openapi.json</openapi.spec>
        <openapi.generated.package>lu.vigasoft.bizzlink.sdk.generated</openapi.generated.package>
    </properties>

    <dependencies>
        <dependency>
            <groupId>tools.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <dependency>
            <groupId>org.jspecify</groupId>
            <artifactId>jspecify</artifactId>
            <version>${jspecify.version}</version>
        </dependency>

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

        <!-- Generated client (from openapi-generator) needs jakarta.annotation at compile time -->
        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <version>2.1.1</version>
            <scope>provided</scope>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit.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.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>3.27.7</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>${openapi.generator.version}</version>
                <executions>
                    <execution>
                        <id>generate-bizzlink-client</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${openapi.spec}</inputSpec>
                            <generatorName>java</generatorName>
                            <library>native</library>
                            <output>${project.build.directory}/generated-sources/openapi</output>

                            <apiPackage>${openapi.generated.package}.api</apiPackage>
                            <modelPackage>${openapi.generated.package}.model</modelPackage>
                            <invokerPackage>${openapi.generated.package}.client</invokerPackage>

                            <generateApiTests>false</generateApiTests>
                            <generateModelTests>false</generateModelTests>
                            <generateApiDocumentation>false</generateApiDocumentation>
                            <generateModelDocumentation>false</generateModelDocumentation>

                            <configOptions>
                                <serializationLibrary>jackson</serializationLibrary>
                                <useJackson3>true</useJackson3>
                                <dateLibrary>java8</dateLibrary>
                                <hideGenerationTimestamp>true</hideGenerationTimestamp>
                                <openApiNullable>false</openApiNullable>
                                <useJakartaEe>true</useJakartaEe>
                                <useJspecify>true</useJspecify>
                                <sourceFolder>src/gen/java/main</sourceFolder>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.6.1</version>
                <executions>
                    <execution>
                        <id>add-generated-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources/openapi/src/gen/java/main</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.15.0</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.5</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.4.0</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.12.0</version>
                <configuration>
                    <doclint>none</doclint>
                    <failOnError>false</failOnError>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!--
            Activate with: ./mvnw -Prelease clean deploy
            Requires:
              - GPG key in your local keyring (gpg -list-keys)
              - <server id="central"> entry in ~/.m2/settings.xml with Central Portal token
        -->
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.2.8</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.10.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>false</autoPublish>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
