<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2021-2026 gematik GmbH
  ~
  ~ 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.
  ~
  ~ *******
  ~
  ~ For additional notes and disclaimer from gematik and in case of changes by gematik find details in the "Readme" file.
  ~
  -->
<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>

  <parent>
    <groupId>de.gematik.test</groupId>
    <artifactId>tiger</artifactId>
    <version>4.3.1</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>tiger-topology-visualizer</artifactId>
  <name>${project.artifactId}</name>
  <description>topology visualizer to visualize the configuration of a test setup</description>

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-stdlib-jdk8</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.dataformat</groupId>
      <artifactId>jackson-dataformat-yaml</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.module</groupId>
      <artifactId>jackson-module-kotlin</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>de.gematik.test</groupId>
      <artifactId>tiger-common</artifactId>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.github.oshai</groupId>
      <artifactId>kotlin-logging-jvm</artifactId>
    </dependency>

  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <version>${version.frontend-maven-plugin}</version>
        <configuration>
          <nodeVersion>${version.node}</nodeVersion>
          <workingDirectory>${project.basedir}/src/frontend/tiger-topology-visualizer</workingDirectory>
        </configuration>

        <executions>
          <execution>
            <id>Install node and npm</id>
            <goals>
              <goal>install-node-and-npm</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <npmInheritsProxyConfigFromMaven>false</npmInheritsProxyConfigFromMaven>
              <nodeVersion>${version.node}</nodeVersion>
              <npmVersion>${version.npm}</npmVersion>
            </configuration>
          </execution>

          <execution>
            <id>npm install</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <arguments>ci</arguments>
            </configuration>
          </execution>

          <execution>
            <id>npm build</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <arguments>run build</arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>${version.maven-resources-plugin}</version>
        <executions>
          <execution>
            <id>copy-frontend-into-static-resources</id>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <phase>process-resources</phase>
            <configuration>
              <outputDirectory>${project.build.directory}/classes/static</outputDirectory>
              <resources>
                <resource>
                  <directory>${project.basedir}/src/frontend/tiger-topology-visualizer/dist</directory>
                  <filtering>false</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-maven-plugin</artifactId>
        <version>${version.kotlin}</version>
        <configuration>
          <jvmTarget>1.8</jvmTarget>
          <compilerPlugins>
            <plugin>spring</plugin>
          </compilerPlugins>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-maven-allopen</artifactId>
            <version>${version.kotlin}</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${version.spring-boot}</version>
        <configuration>
          <mainClass>de.gematik.test.tiger.topology.StandaloneVisualizerApplicationKt</mainClass>
          <!-- Use a classifier so the original JAR stays available for downstream modules -->
          <classifier>standalone</classifier>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
    <testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
  </build>
</project>
