<?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>
	<parent>
		<artifactId>zaf</artifactId>
		<groupId>cz.zaf</groupId>
		<version>2.0.0</version>
	</parent>
	<artifactId>zaf-ws</artifactId>
	<name>ZAF WebServices</name>

	<dependencies>
		<dependency>
			<groupId>cz.zaf</groupId>
			<artifactId>zaf-core</artifactId>
     		<version>${project.version}</version>
		</dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>        
		<dependency>
			<groupId>org.springdoc</groupId>
			<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
			<version>2.8.8</version>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<release>17</release>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.openapitools</groupId>
				<artifactId>openapi-generator-maven-plugin</artifactId>
				<version>7.13.0</version>
				<executions>
					<execution>
						<id>zaf-api</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>generate</goal>
						</goals>
						<configuration>
							<generatorName>spring</generatorName>
							<inputSpec>
								${project.basedir}/src/main/resources/openapi/zaf-api.yaml</inputSpec>
							<output>
								${project.build.directory}/generated-sources/api/rest</output>
							<generateSupportingFiles>false</generateSupportingFiles>
							<skipValidateSpec>true</skipValidateSpec>
							<configOptions>
								<sourceFolder>/</sourceFolder>
								<apiPackage>
									cz.zaf.api.rest.controller</apiPackage>
								<modelPackage>
									cz.zaf.api.rest.model</modelPackage>
								<interfaceOnly>true</interfaceOnly>
								<skipDefaultInterface>true</skipDefaultInterface>
								<openApiNullable>false</openApiNullable>
								<useTags>true</useTags>
								<useSpringBoot3>true</useSpringBoot3>
							</configOptions>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
			    <groupId>org.springframework.boot</groupId>
			    <artifactId>spring-boot-maven-plugin</artifactId>
			    <!-- We are using spring-boot-starter-parent, such execution is already pre-configured 
			         with a repackage execution ID so that only the plugin definition should be added. -->
			    <!--<executions>
			        <execution>
			            <goals>
			                <goal>repackage</goal>
			            </goals>
			        </execution>
			    </executions>-->
				<configuration>
					<mainClass>cz.zaf.validator.ws.ZafApplication</mainClass>
				</configuration>
			</plugin>
		</plugins>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
				<includes>
					<include>**/*.yaml</include>
					<include>zaf-ws.properties</include>
				</includes>
			</resource>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>false</filtering>
				<excludes>
					<exclude>**/*.yaml</exclude>
					<exclude>zaf-ws.properties</exclude>
				</excludes>
			</resource>
		</resources>
	</build>

	<profiles>

		<profile>
			<id>jacoco-report</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.jacoco</groupId>
						<artifactId>jacoco-maven-plugin</artifactId>
						<configuration>
							<excludes>org.drools.compiler.lang.*</excludes>
						</configuration>
						<executions>
							<execution>
								<id>default-prepare-agent</id>
								<goals>
									<goal>prepare-agent</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

</project>
