<?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>me.kpavlov.aimocks</groupId>
    <artifactId>root</artifactId>
    <version>0.1.1</version>
    <packaging>pom</packaging>
    <name>AI Mocks</name>
    <description>AI Mocks</description>
    <url>https://github.com/kpavlov/mock-llm</url>

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

    <developers>
        <developer>
            <name>Konstantin Pavlov</name>
            <url>https://kpavlov.me</url>
            <roles>
                <role>author</role>
                <role>owner</role>
            </roles>
        </developer>
    </developers>

    <modules>
        <module>bom</module>
        <module>mokksy</module>
        <module>ai-mocks-core</module>
        <module>ai-mocks-openai</module>
        <module>reports</module>
    </modules>

    <scm>
        <connection>scm:git:git://github.com/kpavlov/ai-mocks.git</connection>
        <developerConnection>scm:git:ssh://github.com/kpavlov/ai-mocks.git</developerConnection>
        <tag>v0.1.1</tag>
        <url>https://github.com/kpavlov/ai-mocks/tree/main</url>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <kotlin.code.style>official</kotlin.code.style>
        <java.version>17</java.version>
        <kotlin.version>2.1.10</kotlin.version>
        <kotlin.compiler.jvmTarget>${java.version}</kotlin.compiler.jvmTarget>
        <maven.compiler.release>${java.version}</maven.compiler.release>
        <!-- Dependencies -->
        <assertk.version>0.28.1</assertk.version>
        <awaitility.version>4.2.2</awaitility.version>
        <junit.version>5.11.4</junit.version>
        <kotlinx.version>1.10.1</kotlinx.version>
        <kotest.version>6.0.0.M1</kotest.version>
        <mockito.version>5.15.2</mockito.version>
        <slf4j.version>2.0.16</slf4j.version>
        <mockito-kotlin.version>5.4.0</mockito-kotlin.version>
        <ktor.version>3.0.3</ktor.version>
        <openai.version>0.20.0</openai.version>
        <logback.version>1.4.11</logback.version>
        <lc4j-kotlin.version>0.1.7</lc4j-kotlin.version>
        <lc4j.version>1.0.0-alpha1</lc4j.version>
        <assertj.version>3.27.3</assertj.version>
        <kotlinx-serialization.version>1.8.0</kotlinx-serialization.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.ktor</groupId>
                <artifactId>ktor-bom</artifactId>
                <version>${ktor.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-bom</artifactId>
                <version>${kotlin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>io.kotest</groupId>
                <artifactId>kotest-bom</artifactId>
                <version>${kotest.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.jetbrains.kotlinx</groupId>
                <artifactId>kotlinx-coroutines-core-jvm</artifactId>
                <version>${kotlinx.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-bom</artifactId>
                <version>${slf4j.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.jetbrains.kotlinx</groupId>
                <artifactId>kotlinx-coroutines-test-jvm</artifactId>
                <version>${kotlinx.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-bom</artifactId>
                <version>${mockito.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito.kotlin</groupId>
                <artifactId>mockito-kotlin</artifactId>
                <version>${mockito-kotlin.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.willowtreeapps.assertk</groupId>
                <artifactId>assertk-jvm</artifactId>
                <version>${assertk.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.awaitility</groupId>
                <artifactId>awaitility-kotlin</artifactId>
                <version>${awaitility.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <!--suppress KotlinMavenPluginPhase -->
            <artifactId>kotlin-stdlib</artifactId>
        </dependency>
        <!-- Kotlin Serialization JSON dependency -->
        <dependency>
            <groupId>org.jetbrains.kotlinx</groupId>
            <artifactId>kotlinx-serialization-json</artifactId>
            <version>${kotlinx-serialization.version}</version>
        </dependency>
        <!-- Test Dependencies -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.willowtreeapps.assertk</groupId>
            <artifactId>assertk-jvm</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.5.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>3.5.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.8.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.21.0</version>
                </plugin>
                <plugin>
                    <groupId>org.jetbrains.dokka</groupId>
                    <artifactId>dokka-maven-plugin</artifactId>
                    <version>2.0.0</version>
                </plugin>
                <plugin>
                    <groupId>com.github.ozsie</groupId>
                    <artifactId>detekt-maven-plugin</artifactId>
                    <version>1.23.7</version>
                </plugin>
                <plugin>
                    <groupId>org.jetbrains.kotlinx</groupId>
                    <artifactId>kover-maven-plugin</artifactId>
                    <version>0.9.1</version>
                    <extensions>true</extensions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.1.3</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.11.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>3.8.0</version>
                </plugin>
                <plugin>
                    <!-- https://github.com/diffplug/spotless/blob/main/plugin-maven -->
                    <groupId>com.diffplug.spotless</groupId>
                    <artifactId>spotless-maven-plugin</artifactId>
                    <version>2.44.2</version>
                    <configuration>
                        <!-- optional: limit format enforcement to just the files changed by this feature branch -->
                        <ratchetFrom>origin/main</ratchetFrom>
                        <java>
                            <palantirJavaFormat />
                        </java>
                        <kotlin>
                            <ktlint />
                        </kotlin>
                        <markdown>
                            <includes>
                                <!-- You have to set the target manually -->
                                <include>**/*.md</include>
                            </includes>
                            <flexmark />
                        </markdown>
                        <pom>
                            <includes>
                                <!-- You have to set the target manually -->
                                <include>**/pom.xml</include>
                            </includes>
                            <sortPom>
                                <nrOfIndentSpace>4</nrOfIndentSpace>
                                <expandEmptyElements>false</expandEmptyElements>
                            </sortPom>
                        </pom>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jetbrains.kotlin</groupId>
                    <artifactId>kotlin-maven-plugin</artifactId>
                    <version>${kotlin.version}</version>
                    <extensions>true</extensions>
                    <!-- You can set this option
                to automatically take information about lifecycles -->
                    <configuration combine.children="append">
                        <args>
                            <arg>-no-reflect</arg>
                            <arg>-progressive</arg>
                            <arg>-Wextra</arg>
                            <arg>-Xexplicit-api=strict</arg>
                            <arg>-Xjsr305=strict</arg>
                        </args>
                        <apiVersion>1.9</apiVersion>
                        <javaParameters>true</javaParameters>
                        <compilerPlugins>
                            <plugin>kotlinx-serialization</plugin>
                        </compilerPlugins>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.jetbrains.kotlin</groupId>
                            <artifactId>kotlin-maven-serialization</artifactId>
                            <version>${kotlin.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <extensions>false</extensions>
                <!-- You can set this option
            to automatically take information about lifecycles -->
                <executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                            <!-- You can skip the <goals> element
                        if you enable extensions for the plugin -->
                        </goals>
                        <configuration combine.self="append">
                            <sourceDirs>
                                <sourceDir>src/main/kotlin</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <goals>
                            <goal>test-compile</goal>
                            <!-- You can skip the <goals> element
                    if you enable extensions for the plugin -->
                        </goals>
                        <configuration combine.self="append">
                            <sourceDirs>
                                <sourceDir>src/test/kotlin</sourceDir>
                                <sourceDir>src/test/java</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <executions>
                    <!-- Replacing default-compile as it is treated specially by Maven -->
                    <execution>
                        <id>default-compile</id>
                        <phase>none</phase>
                    </execution>
                    <!-- Replacing default-testCompile as it is treated specially by Maven -->
                    <execution>
                        <id>default-testCompile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>java-compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <phase>compile</phase>
                    </execution>
                    <execution>
                        <id>java-test-compile</id>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <phase>test-compile</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>properties</id>
                        <goals>
                            <goal>properties</goal>
                        </goals>
                    </execution>
                    <execution>
                        <goals>
                            <goal>analyze-only</goal>
                        </goals>
                        <configuration>
                            <ignoreNonCompile>true</ignoreNonCompile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!-- https://kotlin.github.io/kotlinx-kover/maven-plugin/#goals -->
                <groupId>org.jetbrains.kotlinx</groupId>
                <artifactId>kover-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>instr</id>
                        <goals>
                            <goal>instrumentation</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>kover-log</id>
                        <goals>
                            <goal>log</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.ozsie</groupId>
                <artifactId>detekt-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>verify</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>javadocJar</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <attach>true</attach>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>true</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <tagNameFormat>v@{project.version}</tagNameFormat>
                    <projectVersionPolicyId>SemVerVersionPolicy</projectVersionPolicyId>
                    <goals>deploy</goals>
                </configuration>
            </plugin>
        </plugins>
        <sourceDirectory>src/main/kotlin</sourceDirectory>
        <testSourceDirectory>src/test/kotlin</testSourceDirectory>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.2.7</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <phase>verify</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <!-- https://central.sonatype.org/publish/publish-portal-maven/ -->
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.7.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                            <waitUntil>validated</waitUntil>
                        </configuration>
                    </plugin>
                    <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>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
