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

    <parent>
        <groupId>dev.tnsai</groupId>
        <artifactId>tnsai-parent</artifactId>
        <version>0.18.6</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>tnsai-server</artifactId>
    <packaging>jar</packaging>

    <name>TnsAI Server</name>
    <description>Framework-first HTTP/WebSocket agent server — session management, streaming, tool execution over a versioned protocol.</description>

    <properties>
        <caffeine.version>3.3.1</caffeine.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>dev.tnsai</groupId>
            <artifactId>tnsai-core</artifactId>
        </dependency>
        <dependency>
            <groupId>dev.tnsai</groupId>
            <artifactId>tnsai-rag</artifactId>
        </dependency>
        <dependency>
            <groupId>dev.tnsai</groupId>
            <artifactId>tnsai-llm</artifactId>
        </dependency>
        <dependency>
            <groupId>dev.tnsai</groupId>
            <artifactId>tnsai-coordination</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>dev.tnsai</groupId>
            <artifactId>tnsai-quality</artifactId>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </dependency>
        <dependency>
            <groupId>io.javalin</groupId>
            <artifactId>javalin</artifactId>
        </dependency>
        <dependency>
            <groupId>com.github.ben-manes.caffeine</groupId>
            <artifactId>caffeine</artifactId>
            <version>${caffeine.version}</version>
        </dependency>

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

    <!--
      maven-shade-plugin lives in the `docker` profile only — produces the
      self-contained executable JAR the Docker image launches with `java -jar`.
      Keeping it off the default lifecycle keeps `mvn install` fast for
      downstream consumers and prevents a redundant fat JAR from polluting
      the published repository tree. Activate with `mvn -Pdocker package`.
    -->
    <profiles>
        <profile>
            <id>docker</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-shade-plugin</artifactId>
                        <version>3.6.2</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                                <configuration>
                                    <shadedArtifactAttached>true</shadedArtifactAttached>
                                    <shadedClassifierName>shaded</shadedClassifierName>
                                    <createDependencyReducedPom>false</createDependencyReducedPom>
                                    <transformers>
                                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                            <mainClass>com.tnsai.server.TnsServerMain</mainClass>
                                        </transformer>
                                        <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                                    </transformers>
                                    <filters>
                                        <filter>
                                            <artifact>*:*</artifact>
                                            <excludes>
                                                <exclude>META-INF/*.SF</exclude>
                                                <exclude>META-INF/*.DSA</exclude>
                                                <exclude>META-INF/*.RSA</exclude>
                                            </excludes>
                                        </filter>
                                    </filters>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
