<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright © 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<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>io.gravitee.policy</groupId>
    <artifactId>gravitee-policy-ai-prompt-token-tracking</artifactId>
    <version>2.0.0</version>
    <name>Gravitee.io APIM - Policy - AI Prompt - Token Tracking</name>
    <description>Tracks and calculates costs for input and output tokens when proxying requests to LLMs</description>

    <parent>
        <groupId>io.gravitee</groupId>
        <artifactId>gravitee-parent</artifactId>
        <version>23.4.1</version>
    </parent>

    <properties>
        <!-- Gravitee dependencies version -->
        <gravitee-apim.version>4.10.0-alpha.1</gravitee-apim.version>

        <!-- Maven plugins -->
        <maven-plugin-assembly.version>3.8.0</maven-plugin-assembly.version>
        <maven-plugin-properties.version>1.2.1</maven-plugin-properties.version>

        <!-- Property used by the publication job in CI-->
        <publish-folder-path>graviteeio-apim/plugins/policies</publish-folder-path>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- Import bom to properly inherit all dependencies -->
            <dependency>
                <groupId>io.gravitee.apim</groupId>
                <artifactId>gravitee-apim-bom</artifactId>
                <version>${gravitee-apim.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- Provided scope -->
        <dependency>
            <groupId>io.gravitee.gateway</groupId>
            <artifactId>gravitee-gateway-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.gravitee.policy</groupId>
            <artifactId>gravitee-policy-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.gravitee.common</groupId>
            <artifactId>gravitee-common</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Test scope -->
        <dependency>
            <groupId>io.gravitee.apim.gateway</groupId>
            <artifactId>gravitee-apim-gateway-tests-sdk</artifactId>
            <version>${gravitee-apim.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.gravitee.apim.plugin.entrypoint</groupId>
            <artifactId>gravitee-apim-plugin-entrypoint-http-proxy</artifactId>
            <version>${gravitee-apim.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.gravitee.apim.plugin.endpoint</groupId>
            <artifactId>gravitee-apim-plugin-endpoint-http-proxy</artifactId>
            <version>${gravitee-apim.version}</version>
            <scope>test</scope>
        </dependency>

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

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <version>${maven-plugin-properties.version}</version>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <id>load-plugin-properties</id>
                        <goals>
                            <goal>read-project-properties</goal>
                        </goals>
                        <configuration>
                            <files>
                                <file>${project.basedir}/src/main/resources/plugin.properties</file>
                            </files>
                            <quiet>false</quiet>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>${maven-plugin-assembly.version}</version>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptors>
                        <descriptor>src/assembly/policy-assembly.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>make-policy-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
