<?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>com.github.phoswald</groupId>
  <artifactId>sample-rstm</artifactId>
  <version>0.1.0-SNAPSHOT</version>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.release>25</maven.compiler.release>
    <maven.compiler.proc>full</maven.compiler.proc>
    <rstm.version>0.1.0-SNAPSHOT</rstm.version>
  </properties>

  <dependencies>
    <!-- Provided -->
    <dependency>
      <groupId>com.github.phoswald</groupId>
      <artifactId>record-builder</artifactId>
      <version>0.1.0</version>
      <scope>provided</scope>
    </dependency>

    <!-- Logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>2.0.17</version>
      <scope>runtime</scope>
    </dependency>

    <!-- RSTM -->
    <dependency>
      <groupId>com.github.phoswald</groupId>
      <artifactId>rstm-config</artifactId>
      <version>${rstm.version}</version>
    </dependency>
    <dependency>
      <groupId>com.github.phoswald</groupId>
      <artifactId>rstm-http</artifactId>
      <version>${rstm.version}</version>
    </dependency>
    <dependency>
      <groupId>com.github.phoswald</groupId>
      <artifactId>rstm-template</artifactId>
      <version>${rstm.version}</version>
    </dependency>

    <!-- Database -->
    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <version>2.4.240</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>42.7.8</version>
      <scope>runtime</scope>
    </dependency>

    <!-- Testing -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>6.0.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <version>6.0.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.20.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.microsoft.playwright</groupId>
      <artifactId>playwright</artifactId>
      <version>1.57.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.14.1</version>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.5.4</version>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>3.8.0</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <descriptors>
            <descriptor>src/assembly/dist.xml</descriptor>
          </descriptors>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>docker</id>
      <build>
        <plugins>
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>0.48.0</version>
            <executions>
              <execution>
                <id>docker-build</id>
                <phase>package</phase>
                <goals>
                  <goal>build</goal>
                </goals>
              </execution>
              <execution>
                <id>docker-push</id>
                <phase>deploy</phase>
                <goals>
                  <goal>push</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <verbose>true</verbose>
              <images>
                <image>
                  <name>philip/${project.artifactId}:${project.version}</name>
                  <build>
                    <dockerFile>Dockerfile</dockerFile>
                    <assembly>
                      <descriptor>${project.basedir}/src/assembly/dist.xml</descriptor>
                    </assembly>
                  </build>
                </image>
              </images>
              <pushRegistry>code.phoswald.ch</pushRegistry> <!-- credentials from ~/.m2/settings.xml -->
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <repositories>
    <repository>
      <id>code.phoswald.ch</id>
      <url>https://code.phoswald.ch/api/packages/philip/maven</url>
    </repository>
  </repositories>

  <distributionManagement>
    <repository>
      <id>code.phoswald.ch</id>
      <url>https://code.phoswald.ch/api/packages/philip/maven</url>
    </repository>
    <snapshotRepository>
      <id>code.phoswald.ch</id>
      <url>https://code.phoswald.ch/api/packages/philip/maven</url>
    </snapshotRepository>
  </distributionManagement>

</project>
