<?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>io.starim</groupId>
  <artifactId>bot-sdk</artifactId>
  <version>0.1.5</version>
  <packaging>jar</packaging>

  <name>StarIM Bot SDK (Java)</name>
  <description>Official Java SDK for StarIM Bot API and Webhooks. StarIM client with HMAC-SHA256 webhook verification, LRU update_id deduplication, command/event router and JDK-only HTTP server.</description>
  <url>https://open.starim.io/</url>
  <inceptionYear>2026</inceptionYear>

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

  <organization>
    <name>StarIM</name>
    <url>https://www.starim.io/</url>
  </organization>

  <developers>
    <developer>
      <id>starim</id>
      <name>StarIM Open Platform Team</name>
      <email>open@starim.io</email>
      <organization>StarIM</organization>
      <organizationUrl>https://www.starim.io/</organizationUrl>
      <roles>
        <role>maintainer</role>
      </roles>
      <timezone>Asia/Shanghai</timezone>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/starim-io/starim.git</connection>
    <developerConnection>scm:git:git@github.com:starim-io/starim.git</developerConnection>
    <url>https://github.com/starim-io/starim/tree/main/botsdk/java</url>
    <tag>HEAD</tag>
  </scm>

  <issueManagement>
    <system>GitHub Issues</system>
    <url>https://github.com/starim-io/starim/issues</url>
  </issueManagement>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
    <maven.compiler.release>17</maven.compiler.release>
    <jackson.version>2.18.1</jackson.version>
    <junit.version>5.11.3</junit.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.datatype</groupId>
      <artifactId>jackson-datatype-jsr310</artifactId>
      <version>${jackson.version}</version>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.13.0</version>
      </plugin>
      <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-source-plugin</artifactId>
        <version>3.3.1</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.11.2</version>
        <configuration>
          <doclint>none</doclint>
          <source>17</source>
          <quiet>true</quiet>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <!--
      release: 触发条件 mvn -P release deploy
      产物：jar + sources jar + javadoc jar + 全部 .asc 签名 + 自动 publish 到 Sonatype Central Portal
      凭证：~/.m2/settings.xml 中的 server id=central（USERTOKEN_USERNAME / USERTOKEN_PASSWORD），
            或环境变量 MAVEN_USERNAME / MAVEN_PASSWORD（CI 友好）
      GPG：~/.gnupg/ 中的私钥；本机默认走 gpg-agent + pinentry（如 pinentry-mac）。
          无图形环境或要把口令交给 Maven 时加 -Dgpg.loopback=true（并配合 -Dgpg.passphrase 或 env）。
    -->
    <!-- CI / 脚本传入 -Dgpg.passphrase 时必须 loopback；本机交互签名不要激活此 profile -->
    <profile>
      <id>gpg-loopback</id>
      <activation>
        <property>
          <name>gpg.loopback</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <configuration>
              <gpgArguments>
                <arg>--pinentry-mode</arg>
                <arg>loopback</arg>
              </gpgArguments>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <!-- Source jar 已在主 build 里 attach -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>3.2.7</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <!-- 默认 false：可走 gpg-agent / pinentry；CI / 无 TTY 请加 -Dgpg.batch=true -->
                <configuration>
                  <batch>false</batch>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.6.0</version>
            <extensions>true</extensions>
            <configuration>
              <!-- settings.xml 中 server id；CI 走环境变量 MAVEN_USERNAME / MAVEN_PASSWORD -->
              <publishingServerId>central</publishingServerId>
              <!-- 默认 manual：deploy 后到 https://central.sonatype.com 手工点 publish；
                   验证流程稳定后可改 automatic -->
              <autoPublish>false</autoPublish>
              <waitUntil>uploaded</waitUntil>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
