<?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/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>com.composum.ai</groupId>
		<artifactId>composum-ai-integration-composum</artifactId>
		<version>0.2.0</version>
	</parent>

	<artifactId>composum-ai-integration-composum-config</artifactId>
	<packaging>content-package</packaging>

	<name>Composum AI::Composum::Config</name>
	<description>
		Configuration for Composum specific package for Composum AI.
	</description>

	<properties>
		<openai.api.key>${env.OPENAI_API_KEY}</openai.api.key>
		<!-- Skip deployment to maven central as this contains configurations. -->
		<maven.deploy.skip>true</maven.deploy.skip>
		<deploy.package>false</deploy.package>
	</properties>

	<build>
		<resources>

			<resource>
				<directory>src/main/content/jcr_root</directory>
				<filtering>true</filtering>
				<excludes>
					<exclude>**/.vlt*</exclude>
					<exclude>**/.DS_Store</exclude>
					<exclude>**/.gitignore</exclude>
				</excludes>
			</resource>

			<resource>
				<directory>${basedir}/src/main/content/META-INF</directory>
				<targetPath>../vault-work/META-INF</targetPath>
			</resource>

		</resources>
		<plugins>

			<plugin>
				<groupId>com.day.jcr.vault</groupId>
				<artifactId>content-package-maven-plugin</artifactId>
				<configuration>

					<group>${package.group}</group>
					<properties>
						<createdBy>${package.company}</createdBy>
					</properties>
					<install>false</install>

					<filters>
						<filter>
							<root>/libs/composum/ai/install</root>
							<includes>
								<include>
									.*/com.composum.ai.backend.base.service.chat.impl.GPTChatCompletionServiceImpl.*
								</include>
							</includes>
						</filter>
					</filters>

				</configuration>
			</plugin>

		</plugins>
	</build>

	<profiles>

		<profile>
			<!-- Try to skip deployment on test.composum.com through Github Actions until OpenAI Key is set. -->
			<id>develop</id>
		</profile>

		<profile>
			<id>installBundle</id>
		</profile>
		<profile>
			<id>installPackage</id>
			<activation>
				<property>
					<name>deploy.package</name>
					<value>true</value>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>com.day.jcr.vault</groupId>
						<artifactId>content-package-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>install-content-package</id>
								<phase>install</phase>
								<goals>
									<goal>install</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>installTestContent</id>
		</profile>

	</profiles>
</project>
