<?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>ai.acolite</groupId>
    <artifactId>openai-agent-sdk</artifactId>
    <version>0.2.0</version>
    <packaging>jar</packaging>

    <name>OpenAI Agent SDK for Java</name>
    <description>A Java SDK for building AI agents with OpenAI's API, featuring multi-agent handoffs, tool calling, memory management, and tracing.</description>
    <url>https://github.com/bnbarak/openai-agent-sdk</url>
    <inceptionYear>2026</inceptionYear>

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

    <developers>
        <developer>
            <id>barak</id>
            <name>Barak</name>
            <organization>Acolite AI</organization>
            <organizationUrl>https://acolite.ai</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/bnbarak/openai-agent-sdk.git</connection>
        <developerConnection>scm:git:ssh://github.com:bnbarak/openai-agent-sdk.git</developerConnection>
        <url>https://github.com/bnbarak/openai-agent-sdk/tree/main</url>
    </scm>

    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/bnbarak/openai-agent-sdk/issues</url>
    </issueManagement>

    <properties>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.openai</groupId>
            <artifactId>openai-java</artifactId>
            <version>4.15.0</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.30</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
            <version>3.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>8.0.1.Final</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.16.1</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>2.0.9</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.4.14</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.10.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.bytebuddy</groupId>
            <artifactId>byte-buddy</artifactId>
            <version>1.14.11</version>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>5.8.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>5.8.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit-pioneer</groupId>
            <artifactId>junit-pioneer</artifactId>
            <version>2.3.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.xerial</groupId>
            <artifactId>sqlite-jdbc</artifactId>
            <version>3.45.0.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <configuration>
                    <source>21</source>
                    <target>21</target>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>1.18.30</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>

            <!-- This plugin supports the @SetEnvironmentVariable annotation in tests. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.2.3</version>
                <configuration>
                    <excludes>
                        <exclude>**/*RealAPITest.java</exclude>
                        <exclude>**/*IntegrationTest.java</exclude>
                    </excludes>
                    <argLine>
                        --add-opens=java.base/java.util=ALL-UNNAMED
                        --add-opens=java.base/java.lang=ALL-UNNAMED
                    </argLine>
                </configuration>
            </plugin>

            <!-- Checkstyle: Code linting (ESLint-like rules) -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.3.1</version>
                <configuration>
                    <configLocation>spotless-checkstyle.xml</configLocation>
                    <consoleOutput>true</consoleOutput>
                    <failsOnError>true</failsOnError>
                    <linkXRef>false</linkXRef>
                </configuration>
                <executions>
                    <execution>
                        <id>checkstyle-check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>10.12.4</version>
                    </dependency>
                </dependencies>
            </plugin>

            <!-- Spotless: Code formatting enforcement -->
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>2.43.0</version>
                <configuration>
                    <java>
                        <!-- Use Google Java Format -->
                        <googleJavaFormat>
                            <version>1.19.2</version>
                            <style>GOOGLE</style>
                        </googleJavaFormat>

                        <!-- Remove unused imports -->
                        <removeUnusedImports />

                        <!-- Import order (alphabetical, static imports first) -->
                        <importOrder />

                        <!-- Trim trailing whitespace -->
                        <trimTrailingWhitespace />

                        <!-- Ensure file ends with newline -->
                        <endWithNewline />

                        <!-- Format files -->
                        <includes>
                            <include>src/main/java/**/*.java</include>
                            <include>src/test/java/**/*.java</include>
                        </includes>

                        <!-- Fail build if spotless:off comments are used -->
                        <toggleOffOn>
                            <off>SPOTLESS-OFF-NEVER-USE</off>
                            <on>SPOTLESS-ON-NEVER-USE</on>
                        </toggleOffOn>
                    </java>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>verify</phase>
                    </execution>
                </executions>
            </plugin>

            <!-- JAR Plugin: Exclude examples from published JAR -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <excludes>
                        <exclude>**/examples/**</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <!-- Source Plugin: Attach sources JAR (required by Maven Central) -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Javadoc Plugin: Attach javadoc JAR (required by Maven Central) -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.6.3</version>
                <configuration>
                    <excludePackageNames>*.examples.*</excludePackageNames>
                    <!-- Ignore Lombok-generated code that Javadoc can't see -->
                    <doclint>none</doclint>
                    <quiet>true</quiet>
                    <additionalOptions>-Xdoclint:none</additionalOptions>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Central Publishing Maven Plugin: Deploy to Maven Central via new Central Portal -->
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>0.6.0</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                    <autoPublish>true</autoPublish>
                    <waitUntil>published</waitUntil>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- Release Profile: Activate for Maven Central publishing (includes GPG signing) -->
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <!-- GPG Plugin: Sign artifacts (required by Maven Central) -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- E2E Profile: Run all tests including expensive real-world API tests and examples -->
        <profile>
            <id>e2e</id>
            <build>
                <plugins>
                    <!-- Surefire for unit tests -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>3.2.3</version>
                        <configuration>
                            <argLine>
                                --add-opens=java.base/java.util=ALL-UNNAMED
                                --add-opens=java.base/java.lang=ALL-UNNAMED
                            </argLine>
                            <!-- Run all tests including those tagged with @Tag("e2e") or @Tag("integration") -->
                            <groups>unit, integration, e2e</groups>
                        </configuration>
                    </plugin>

                    <!-- Failsafe for integration tests -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>3.2.3</version>
                        <configuration>
                            <includes>
                                <include>**/*RealAPITest.java</include>
                                <include>**/*IntegrationTest.java</include>
                            </includes>
                            <argLine>
                                --add-opens=java.base/java.util=ALL-UNNAMED
                                --add-opens=java.base/java.lang=ALL-UNNAMED
                            </argLine>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Exec plugin for running examples -->
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>3.1.1</version>
                        <configuration>
                            <cleanupDaemonThreads>false</cleanupDaemonThreads>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
