<?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>
    <groupId>com.github.auties00</groupId>
    <artifactId>cobalt</artifactId>
    <version>0.0.4</version>
    <name>${project.groupId}:${project.artifactId}</name>
    <description>Standalone fully-featured Whatsapp Web API for Java and Kotlin</description>
    <url>https://github.com/Auties00/Cobalt</url>

    <developers>
        <developer>
            <name>Alessandro Autiero</name>
            <email>alautiero@gmail.com</email>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>https://www.opensource.org/licenses/mit-license.php</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/Auties00/Cobalt/tree/master</url>
        <connection>scm:git:https://github.com/Auties00/Cobalt.git</connection>
        <developerConnection>scm:ssh:https://github.com/Auties00/Cobalt.git</developerConnection>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <repositories>
        <repository>
            <id>AsposeJavaAPI</id>
            <name>Aspose Java API</name>
            <url>https://releases.aspose.com/java/repo/</url>
        </repository>
        <repository>
            <id>jitpack.io</id>
            <name>Jitpack</name>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <profiles>
        <profile>
            <id>sign</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <!-- Attach the sourcecode -->
                    <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</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Generate and attach javadocs from source -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven.javadoc.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <release>${java.version}</release>
                            <failOnError>true</failOnError>
                            <show>private</show>
                            <debug>true</debug>
                            <verbose>true</verbose>
                        </configuration>
                    </plugin>

                    <!-- Sign the artifacts -->
                    <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>
                                <configuration>
                                    <keyname>${gpg.keyname}</keyname>
                                    <passphraseServerId>${gpg.passphrase}</passphraseServerId>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Deploy the artifact -->
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${maven.nexus.plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>uber-jar</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <descriptorRefs>
                                <descriptorRef>jar-with-dependencies</descriptorRef>
                            </descriptorRefs>
                        </configuration>
                        <executions>
                            <execution>
                                <id>make-assembly</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>21</java.version>
        <maven.surefire.plugin.version>3.0.0-M9</maven.surefire.plugin.version>
        <maven.gpg.plugin.version>3.0.1</maven.gpg.plugin.version>
        <maven.compiler.plugin.version>3.11.0</maven.compiler.plugin.version>
        <maven.source.plugin.version>3.2.1</maven.source.plugin.version>
        <maven.javadoc.plugin.version>3.5.0</maven.javadoc.plugin.version>
        <maven.nexus.plugin.version>1.6.13</maven.nexus.plugin.version>
        <zxing.version>3.5.1</zxing.version>
        <protoc.version>3.0.4</protoc.version>
        <junit.version>5.10.0-M1</junit.version>
        <jackson.version>2.15.2</jackson.version>
        <curve25519.version>1.2</curve25519.version>
        <lazysodium.version>5.1.4</lazysodium.version>
        <linkpreview.version>2.3</linkpreview.version>
        <vcard.version>0.12.1</vcard.version>
        <qr.terminal.version>2.2</qr.terminal.version>
        <libphonenumber.version>8.13.13</libphonenumber.version>
        <maven.versions.version>2.15.0</maven.versions.version>
        <apk.parser.version>master-SNAPSHOT</apk.parser.version>
        <plist.version>1.27</plist.version>
        <aspose.words.version>22.11</aspose.words.version>
        <ffmpeg.version>2023.09.10</ffmpeg.version>
    </properties>

    <build>
        <plugins>
            <!-- Compile the project-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <executions>
                    <execution>
                        <id>process-test-annotations</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <annotationProcessorPaths>
                                <annotationProcessorPath>
                                    <groupId>${groupId}</groupId>
                                    <artifactId>${artifactId}</artifactId>
                                    <version>${version}</version>
                                </annotationProcessorPath>
                            </annotationProcessorPaths>
                            <annotationProcessors>
                                <annotationProcessor>it.auties.whatsapp.listener.processor.RegisterListenerProcessor</annotationProcessor>
                            </annotationProcessors>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <release>${java.version}</release>
                    <annotationProcessorPaths>
                        <annotationProcessorPath>
                            <groupId>com.github.auties00</groupId>
                            <artifactId>protobuf-serialization-plugin</artifactId>
                            <version>${protoc.version}</version>
                        </annotationProcessorPath>
                    </annotationProcessorPaths>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                    <failOnError>true</failOnError>
                </configuration>
            </plugin>

            <!-- Test the library to be sure that everything works-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>org.junit.jupiter</groupId>
                        <artifactId>junit-jupiter-engine</artifactId>
                        <version>${junit.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <!-- Generate and print QR code (Web API) -->
        <dependency>
            <groupId>com.google.zxing</groupId>
            <artifactId>javase</artifactId>
            <version>${zxing.version}</version>
        </dependency>
        <dependency>
            <groupId>com.github.auties00</groupId>
            <artifactId>qr-terminal</artifactId>
            <version>${qr.terminal.version}</version>
        </dependency>

        <!-- Cryptography (used by Whatsapp) -->
        <dependency>
            <groupId>com.github.auties00</groupId>
            <artifactId>curve25519</artifactId>
            <version>${curve25519.version}</version>
        </dependency>

        <!-- Protobuf serialization (used by Whatsapp) -->
        <dependency>
            <groupId>com.github.auties00</groupId>
            <artifactId>protobuf-base</artifactId>
            <version>${protoc.version}</version>
        </dependency>

        <!-- Json serialization (used by Whatsapp) -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-parameter-names</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jdk8</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <!-- Parse phone numbers (Mobile API) -->
        <dependency>
            <groupId>com.googlecode.libphonenumber</groupId>
            <artifactId>libphonenumber</artifactId>
            <version>${libphonenumber.version}</version>
        </dependency>

        <!-- Parse Android APK for token generation (Mobile API) -->
        <dependency>
            <groupId>com.github.Auties00</groupId>
            <artifactId>apk-parser</artifactId>
            <version>${apk.parser.version}</version>
        </dependency>

        <!-- Parse PLIST files for Apple APNS (Mobile API) -->
        <dependency>
            <groupId>com.googlecode.plist</groupId>
            <artifactId>dd-plist</artifactId>
            <version>${plist.version}</version>
        </dependency>

        <!-- Generate message previews -->
        <dependency>
            <groupId>com.github.auties00</groupId>
            <artifactId>link-preview</artifactId>
            <version>${linkpreview.version}</version>
        </dependency>
        <dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose-words</artifactId>
            <version>${aspose.words.version}</version>
            <classifier>jdk17</classifier>
        </dependency>
        <dependency>
            <groupId>com.github.kokorin.jaffree</groupId>
            <artifactId>jaffree</artifactId>
            <version>${ffmpeg.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.32</version>
        </dependency>
        <dependency>
            <groupId>com.googlecode.ez-vcard</groupId>
            <artifactId>ez-vcard</artifactId>
            <version>${vcard.version}</version>
        </dependency>

        <!-- Testing framework -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
