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

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.4.4</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>com.objective.threesixty</groupId>
    <artifactId>threesixty-sdk</artifactId>
    <version>${revision}${sha1}${changelist}</version>
    <packaging>jar</packaging>

    <name>3Sixty SDK</name>
    <description>Objective 3Sixty SDK</description>
    <url>https://www.objective.com/products/objective-3sixty</url>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>https://opensource.org/license/mit</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Objective Corporation</name>
            <email>support@objective.com</email>
            <organization>Objective Corporation</organization>
            <organizationUrl>https://www.objective.com/products/objective-3sixty</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git@github.com:Objective-Corporation/3Sixty-SDK-Samples.git</connection>
        <developerConnection>scm:git:https://github.com/Objective-Corporation/3Sixty-SDK-Samples.git</developerConnection>
        <url>https://github.com/Objective-Corporation/3Sixty-SDK-Samples</url>
    </scm>

    <properties>
        <!-- For Build Version -->
        <revision>1.5.0</revision>
        <sha1></sha1>
        <changelist></changelist>

        <!-- For license Copyright year -->
        <copyright.year>2024</copyright.year>
        <copyright.update>false</copyright.update>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <java.version>17</java.version>

        <com.azure.azure-core.version>1.44.0</com.azure.azure-core.version>
        <com.google.code.gson.version>2.11.0</com.google.code.gson.version>
        <com.google.guava.version>33.3.0-jre</com.google.guava.version>
        <com.google.j2objc.version>3.0.0</com.google.j2objc.version>
        <com.google.protobuf.version>3.25.5</com.google.protobuf.version>
        <grpc.version>1.68.0</grpc.version>
        <org.apache.commons.codec.version>1.17.0</org.apache.commons.codec.version>
        <org.json.version>20240303</org.json.version>
        <protoc.version>3.25.5</protoc.version>

        <sonar.host.url>https://sonar.core.objective.com/</sonar.host.url>
        <sonar.jacoco.coveragePlugin>jacoco</sonar.jacoco.coveragePlugin>

        <objective.3sixty.grpc.version>1.4.0</objective.3sixty.grpc.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-bom</artifactId>
                <version>${grpc.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-java-util</artifactId> <!-- prevent downgrade via protobuf-java-util -->
                <version>${com.google.protobuf.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>${com.google.code.gson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId> <!-- prevent downgrade of version in guava -->
                <version>${com.google.guava.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.j2objc</groupId>
                <artifactId>j2objc-annotations</artifactId>
                <version>${com.google.j2objc.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- Objective 3Sixty gRPC project -->
        <dependency>
            <groupId>com.objective.threesixty</groupId>
            <artifactId>objective-3sixty-grpc</artifactId>
            <version>${objective.3sixty.grpc.version}</version>
        </dependency>

        <!-- gRPC dependencies -->
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java-util</artifactId>
        </dependency>

        <!-- Other dependencies -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>${org.json.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <!-- Reactive Programming for binary processing -->
        <dependency>
            <groupId>com.azure</groupId>
            <artifactId>azure-core</artifactId>
            <version>${com.azure.azure-core.version}</version>
        </dependency>
        <!-- MD5 Hash Generation -->
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>${org.apache.commons.codec.version}</version>
        </dependency>

        <!-- Tests -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>publish-artifact</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.1</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.8.0</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.2.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <useAgent>false</useAgent>
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.5.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>maven-central-publisher-repo</publishingServerId>
                            <autoPublish>true</autoPublish>
                            <waitUntil>published</waitUntil>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <reporting>
        <plugins>
            <!-- sonar plugin -->
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>3.6.0.1398</version>
            </plugin>
        </plugins>
    </reporting>

    <build>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.11</version>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <haltOnFailure>false</haltOnFailure>
                            <rules>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>2.4.0</version>
                <configuration>
                    <emptyLineAfterHeader>true</emptyLineAfterHeader> <!-- Places an empty line after the header -->
                    <canUpdateCopyright>${copyright.update}</canUpdateCopyright> <!-- Allows update of copyright year/owner -->
                    <sectionDelimiter>-</sectionDelimiter> <!-- Delimiter between sections -->
                    <processStartTag>%%</processStartTag> <!-- a start tag used by the plugin. necessary -->
                    <processEndTag>%-</processEndTag> <!-- a start tag used by the plugin. necessary -->
                    <failOnNotUptodateHeader>true
                    </failOnNotUptodateHeader> <!-- Forces the plugin to fail is a file is not updated when it's supposed to be -->
                </configuration>
                <executions>
                    <execution>
                        <id>first</id>
                        <goals>
                            <goal>update-file-header</goal>
                        </goals>
                        <phase>process-sources</phase>
                        <configuration>
                            <licenseName>mit</licenseName>
                            <organizationName>Objective Corporation Limited.</organizationName>
                            <inceptionYear>${copyright.year}</inceptionYear>
                            <roots>
                                <root>src/main/java</root>
                                <root>src/test</root>
                            </roots>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
