<?xml version="1.0"?>
<project
    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"
    xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.kie.kogito.examples</groupId>
    <artifactId>kogito-examples</artifactId>
    <version>1.9.0.Final</version>
  </parent>

  <artifactId>process-postgresql-persistence-quarkus</artifactId>

  <name>Kogito Example :: Process PostgreSQL Persistence Quarkus</name>
  <description>Process with PostgreSQL persistence - Quarkus</description>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.kie.kogito</groupId>
        <artifactId>kogito-quarkus-bom</artifactId>
        <version>${kogito.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy</artifactId>
    </dependency>
    <dependency>
      <groupId>org.kie.kogito</groupId>
      <artifactId>kogito-quarkus</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-openapi</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-health</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kie.kogito</groupId>
      <artifactId>kogito-test-utils</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
      <plugin>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>persistence</id>
      <activation>
        <property>
          <name>persistence</name>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.kie.kogito</groupId>
          <artifactId>kogito-addons-persistence-postgresql</artifactId>
        </dependency>
        <dependency>
          <groupId>io.quarkus</groupId>
          <artifactId>quarkus-reactive-pg-client</artifactId>
        </dependency>
      </dependencies>
      <build>
       <plugins>
         <plugin>
           <artifactId>maven-antrun-plugin</artifactId>
           <executions>
             <execution>
                <phase>generate-sources</phase>
               <goals>
                 <goal>run</goal>
               </goals>
               <configuration>
                 <target>
                   <delete file="src/main/resources/application.properties"/>
                   <copy file="src/main/resources/postgresql.properties"
                         tofile="src/main/resources/application.properties"/>
                 </target>
               </configuration>
             </execution>
           </executions>
         </plugin>
       </plugins>
     </build>
    </profile>
    <profile>
     <id>jdbc-persistence</id>
     <dependencies>
        <dependency>
          <groupId>org.kie.kogito</groupId>
          <artifactId>kogito-addons-persistence-jdbc</artifactId>
        </dependency>
        <dependency>
          <groupId>io.quarkus</groupId>
          <artifactId>quarkus-jdbc-postgresql</artifactId>
        </dependency>
        <dependency>
         <groupId>io.quarkus</groupId>
         <artifactId>quarkus-agroal</artifactId>
        </dependency>
     </dependencies>
     <build>
       <plugins>
         <plugin>
           <artifactId>maven-antrun-plugin</artifactId>
           <executions>
             <execution>
                <phase>generate-sources</phase>
               <goals>
                 <goal>run</goal>
               </goals>
               <configuration>
                 <target>
                   <delete file="src/main/resources/application.properties"/>
                   <copy file="src/main/resources/jdbc.properties"
                         tofile="src/main/resources/application.properties"/>
                 </target>
               </configuration>
             </execution>
           </executions>
         </plugin>
       </plugins>
     </build>
   </profile>
  </profiles>
</project>
