<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>

    <parent>
        <groupId>dev.dokimos</groupId>
        <artifactId>dokimos-parent</artifactId>
        <version>0.23.0</version>
    </parent>

    <properties>
        <!--
          Compiled against the oldest supported koog. Koog is a provided dependency and the
          event-handler glue is reflective, so the artifact runs unchanged against 0.6.4 through
          1.0.0; the adapter-compat CI matrix exercises that range.
        -->
        <koog.version>0.6.4</koog.version>
        <kotlinx.coroutines.version>1.9.0</kotlinx.coroutines.version>
        <kotlinx.serialization.version>1.9.0</kotlinx.serialization.version>
        <mockk.version>1.14.6</mockk.version>
        <kotlin.version>2.3.10</kotlin.version>
        <maven.javadoc.skip>true</maven.javadoc.skip>
    </properties>

    <artifactId>dokimos-koog</artifactId>
    <name>Dokimos :: Integration :: Koog</name>
    <description>Koog integration for Dokimos</description>

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



    <dependencies>
        <dependency>
            <groupId>dev.dokimos</groupId>
            <artifactId>dokimos-kotlin</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>ai.koog</groupId>
            <artifactId>koog-agents-jvm</artifactId>
            <version>${koog.version}</version>
        </dependency>

        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jetbrains.kotlinx</groupId>
            <artifactId>kotlinx-coroutines-core</artifactId>
            <version>${kotlinx.coroutines.version}</version>
        </dependency>

        <dependency>
            <groupId>ai.koog</groupId>
            <artifactId>agents-test-jvm</artifactId>
            <version>${koog.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jetbrains.kotlinx</groupId>
            <artifactId>kotlinx-coroutines-test</artifactId>
            <version>${kotlinx.coroutines.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.mockk</groupId>
            <artifactId>mockk-jvm</artifactId>
            <version>${mockk.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
        <testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <version>2.1.0</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <phase>package</phase>
                        <goals>
                            <goal>javadocJar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <jvmTarget>${java.version}</jvmTarget>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                        <configuration>
                            <jvmTarget>${java.version}</jvmTarget>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!--
          The live integration test builds a real agent with koog's agent-construction API, which
          only resolves on the 0.6.x floor and needs the kotlinx-serialization compiler plugin to
          serialize its tool arguments. It is compiled in normal builds but excluded from the
          adapter-compat matrix (which runs with -P!koog-live-it) so the matrix can sweep koog
          versions the construction API does not support.
        -->
        <profile>
            <id>koog-live-it</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <dependencyManagement>
                <dependencies>
                    <dependency>
                        <groupId>org.jetbrains.kotlinx</groupId>
                        <artifactId>kotlinx-serialization-core-jvm</artifactId>
                        <version>${kotlinx.serialization.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.jetbrains.kotlinx</groupId>
                        <artifactId>kotlinx-serialization-json-jvm</artifactId>
                        <version>${kotlinx.serialization.version}</version>
                    </dependency>
                </dependencies>
            </dependencyManagement>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>3.6.0</version>
                        <executions>
                            <execution>
                                <id>add-live-it-source</id>
                                <phase>generate-test-sources</phase>
                                <goals>
                                    <goal>add-test-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>${project.basedir}/src/it/kotlin</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.jetbrains.kotlin</groupId>
                        <artifactId>kotlin-maven-plugin</artifactId>
                        <configuration>
                            <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>
            </build>
        </profile>
    </profiles>
</project>
