<?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>com.marcosbarbero</groupId>
    <artifactId>scim2-sdk-parent</artifactId>
    <version>0.8.45</version>
    <packaging>pom</packaging>

    <name>SCIM 2.0 SDK for JVM</name>
    <description>A SCIM 2.0 (RFC 7643/7644) SDK for the JVM, written in Kotlin with full Java interop.</description>
    <url>https://github.com/marcosbarbero/scim2-sdk-jvm</url>

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

    <developers>
        <developer>
            <id>marcosbarbero</id>
            <name>Marcos Barbero</name>
            <email>marcos.hgb@gmail.com</email>
            <url>https://github.com/marcosbarbero</url>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/marcosbarbero/scim2-sdk-jvm.git</connection>
        <developerConnection>scm:git:ssh://github.com:marcosbarbero/scim2-sdk-jvm.git</developerConnection>
        <url>https://github.com/marcosbarbero/scim2-sdk-jvm</url>
    </scm>

    <modules>
        <module>scim2-sdk-bom</module>
        <module>scim2-sdk-core</module>
        <module>scim2-sdk-server</module>
        <module>scim2-sdk-client</module>
        <module>scim2-sdk-client-httpclient</module>
        <module>scim2-sdk-client-okhttp</module>
        <module>scim2-sdk-spring-boot-autoconfigure</module>
        <module>scim2-sdk-spring-boot-starter</module>
        <module>scim2-sdk-test</module>
        <module>scim2-sdk-samples/sample-server-spring</module>
        <module>scim2-sdk-samples/sample-fullstack-spring</module>
        <module>scim2-sdk-samples/sample-fullstack-plain</module>
    </modules>

    <properties>
        <revision>0.1.0-SNAPSHOT</revision>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <java.version>25</java.version>
        <kotlin.jvm-target>23</kotlin.jvm-target>
        <kotlin.version>2.4.0</kotlin.version>
        <kotest.version>6.1.11</kotest.version>
        <mockk.version>1.14.11</mockk.version>
        <spring-boot.version>4.0.6</spring-boot.version>

        <kotlinx-coroutines.version>1.11.0</kotlinx-coroutines.version>
        <okhttp.version>5.3.2</okhttp.version>
        <testcontainers.version>2.0.5</testcontainers.version>
        <wiremock.version>3.13.2</wiremock.version>
        <pact.version>4.7.1</pact.version>

        <maven-compiler-plugin.version>3.15.0</maven-compiler-plugin.version>
        <maven-surefire-plugin.version>3.5.6</maven-surefire-plugin.version>
        <maven-failsafe-plugin.version>3.5.2</maven-failsafe-plugin.version>
        <maven-enforcer-plugin.version>3.6.3</maven-enforcer-plugin.version>
        <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
        <maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
        <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
        <jacoco-maven-plugin.version>0.8.15</jacoco-maven-plugin.version>
        <flatten-maven-plugin.version>1.7.3</flatten-maven-plugin.version>
        <central-publishing-maven-plugin.version>0.10.0</central-publishing-maven-plugin.version>
        <pitest-maven.version>1.25.4</pitest-maven.version>
        <pitest-kotlin.version>1.2.2</pitest-kotlin.version>
        <pitest-junit5-plugin.version>1.2.3</pitest-junit5-plugin.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- Kotlin -->
            <dependency>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-bom</artifactId>
                <version>${kotlin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.jetbrains.kotlinx</groupId>
                <artifactId>kotlinx-coroutines-core</artifactId>
                <version>${kotlinx-coroutines.version}</version>
            </dependency>

            <!-- Testcontainers (before Spring Boot to prevent version override to 2.x) -->
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>testcontainers-bom</artifactId>
                <version>${testcontainers.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Spring Boot (manages Jackson, SLF4J, JUnit, etc.) -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- OkHttp -->
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>okhttp-jvm</artifactId>
                <version>${okhttp.version}</version>
            </dependency>

            <!-- Test -->
            <dependency>
                <groupId>io.kotest</groupId>
                <artifactId>kotest-assertions-core-jvm</artifactId>
                <version>${kotest.version}</version>
            </dependency>
            <dependency>
                <groupId>io.mockk</groupId>
                <artifactId>mockk-jvm</artifactId>
                <version>${mockk.version}</version>
            </dependency>
            <dependency>
                <groupId>org.wiremock</groupId>
                <artifactId>wiremock-standalone</artifactId>
                <version>${wiremock.version}</version>
            </dependency>
            <dependency>
                <groupId>au.com.dius.pact.consumer</groupId>
                <artifactId>junit5</artifactId>
                <version>${pact.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>au.com.dius.pact.provider</groupId>
                <artifactId>junit5</artifactId>
                <version>${pact.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>io.github.serpro69</groupId>
                <artifactId>kotlin-faker</artifactId>
                <version>1.16.1</version>
            </dependency>

            <!-- SDK modules -->
            <dependency>
                <groupId>com.marcosbarbero</groupId>
                <artifactId>scim2-sdk-core</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.marcosbarbero</groupId>
                <artifactId>scim2-sdk-server</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.marcosbarbero</groupId>
                <artifactId>scim2-sdk-client</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.marcosbarbero</groupId>
                <artifactId>scim2-sdk-client-httpclient</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.marcosbarbero</groupId>
                <artifactId>scim2-sdk-client-okhttp</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.marcosbarbero</groupId>
                <artifactId>scim2-sdk-spring-boot-autoconfigure</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.marcosbarbero</groupId>
                <artifactId>scim2-sdk-spring-boot-starter</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.marcosbarbero</groupId>
                <artifactId>scim2-sdk-test</artifactId>
                <version>${project.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.jetbrains.kotlin</groupId>
                    <artifactId>kotlin-maven-plugin</artifactId>
                    <version>${kotlin.version}</version>
                    <configuration>
                        <jvmTarget>${kotlin.jvm-target}</jvmTarget>
                        <args>
                            <arg>-Xannotation-default-target=param-property</arg>
                        </args>
                        <compilerPlugins>
                            <plugin>spring</plugin>
                            <plugin>jpa</plugin>
                        </compilerPlugins>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.jetbrains.kotlin</groupId>
                            <artifactId>kotlin-maven-allopen</artifactId>
                            <version>${kotlin.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>org.jetbrains.kotlin</groupId>
                            <artifactId>kotlin-maven-noarg</artifactId>
                            <version>${kotlin.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>compile</id>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                            <configuration>
                                <sourceDirs>
                                    <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                                </sourceDirs>
                            </configuration>
                        </execution>
                        <execution>
                            <id>test-compile</id>
                            <goals>
                                <goal>test-compile</goal>
                            </goals>
                            <configuration>
                                <sourceDirs>
                                    <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
                                </sourceDirs>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <release>${java.version}</release>
                    </configuration>
                    <executions>
                        <execution>
                            <id>default-compile</id>
                            <phase>none</phase>
                        </execution>
                        <execution>
                            <id>default-testCompile</id>
                            <phase>none</phase>
                        </execution>
                        <execution>
                            <id>java-compile</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>java-test-compile</id>
                            <phase>test-compile</phase>
                            <goals>
                                <goal>testCompile</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <argLine>${argLine}</argLine>
                        <!-- Unit tests only: exclude CT (contract), IT (integration), E2E -->
                        <excludes>
                            <exclude>**/*CT.java</exclude>
                            <exclude>**/*CT.kt</exclude>
                            <exclude>**/*IT.java</exclude>
                            <exclude>**/*IT.kt</exclude>
                            <exclude>**/*E2E.java</exclude>
                            <exclude>**/*E2E.kt</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <argLine>${argLine}</argLine>
                        <!-- Integration tests: *IT files only -->
                        <includes>
                            <include>**/*IT.java</include>
                            <include>**/*IT.kt</include>
                        </includes>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${maven-enforcer-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>enforce-versions</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <requireMavenVersion>
                                        <version>[3.9,)</version>
                                    </requireMavenVersion>
                                    <requireJavaVersion>
                                        <version>[25,)</version>
                                    </requireJavaVersion>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-maven-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>prepare-agent</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>report</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.jetbrains.dokka</groupId>
                    <artifactId>dokka-maven-plugin</artifactId>
                    <version>2.2.0</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>javadocJar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.pitest</groupId>
                    <artifactId>pitest-maven</artifactId>
                    <version>${pitest-maven.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>com.arcmutate</groupId>
                            <artifactId>pitest-kotlin</artifactId>
                            <version>${pitest-kotlin.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>org.pitest</groupId>
                            <artifactId>pitest-junit5-plugin</artifactId>
                            <version>${pitest-junit5-plugin.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven-source-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${maven-gpg-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>flatten-maven-plugin</artifactId>
                    <version>${flatten-maven-plugin.version}</version>
                    <configuration>
                        <updatePomFile>true</updatePomFile>
                        <flattenMode>resolveCiFriendliesOnly</flattenMode>
                    </configuration>
                    <executions>
                        <execution>
                            <id>flatten</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>flatten</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>flatten-clean</id>
                            <phase>clean</phase>
                            <goals>
                                <goal>clean</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.central</groupId>
                    <artifactId>central-publishing-maven-plugin</artifactId>
                    <version>${central-publishing-maven-plugin.version}</version>
                    <extensions>true</extensions>
                    <configuration>
                        <publishingServerId>central</publishingServerId>
                        <autoPublish>true</autoPublish>
                        <waitUntil>published</waitUntil>
                        <excludeArtifacts>
                            <excludeArtifact>sample-server-spring</excludeArtifact>
                            <excludeArtifact>sample-fullstack-spring</excludeArtifact>
                            <excludeArtifact>sample-fullstack-plain</excludeArtifact>
                        </excludeArtifacts>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
        <testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>flatten-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>5.0.0</version>
                <configuration>
                    <licenseSets>
                        <licenseSet>
                            <header>${maven.multiModuleProjectDirectory}/src/main/resources/license-header.txt</header>
                            <includes>
                                <include>**/*.kt</include>
                                <include>**/*.java</include>
                            </includes>
                            <excludes>
                                <exclude>**/target/**</exclude>
                            </excludes>
                        </licenseSet>
                    </licenseSets>
                    <properties>
                        <year>2026</year>
                    </properties>
                    <mapping>
                        <kt>SLASHSTAR_STYLE</kt>
                    </mapping>
                </configuration>
                <executions>
                    <execution>
                        <id>check-license</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>3.6.0</version>
                <configuration>
                    <kotlin>
                        <includes>
                            <include>src/**/*.kt</include>
                        </includes>
                        <ktlint>
                            <version>1.5.0</version>
                            <editorConfigOverride>
                                <max_line_length>off</max_line_length>
                                <ktlint_standard_no-blank-line-in-list>disabled</ktlint_standard_no-blank-line-in-list>
                            </editorConfigOverride>
                        </ktlint>
                    </kotlin>
                    <!-- Java formatting disabled: google-java-format and palantir-java-format
                         are incompatible with Java 25 internal APIs. Re-enable when they support JDK 25. -->
                </configuration>
            </plugin>
            <!-- Git hooks: .githooks/ contains the hooks, configured via git config core.hooksPath -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.6.3</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>install-git-hooks</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>git</executable>
                            <arguments>
                                <argument>config</argument>
                                <argument>core.hooksPath</argument>
                                <argument>.githooks</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- mvn test -Pcontract-tests -->
        <profile>
            <id>contract-tests</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <excludes combine.self="override" />
                            <includes>
                                <include>**/*CT.java</include>
                                <include>**/*CT.kt</include>
                            </includes>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- mvn test -Pe2e -->
        <profile>
            <id>e2e</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <excludes combine.self="override" />
                            <includes>
                                <include>**/*E2E.java</include>
                                <include>**/*E2E.kt</include>
                            </includes>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>mutation</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.pitest</groupId>
                        <artifactId>pitest-maven</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.jetbrains.dokka</groupId>
                        <artifactId>dokka-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <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>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
