<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>io.serverlessworkflow</groupId>
        <artifactId>serverlessworkflow-parent</artifactId>
        <version>5.0.0.Final</version>
    </parent>

    <artifactId>serverlessworkflow-api</artifactId>
    <name>Serverless Workflow :: API</name>
    <packaging>jar</packaging>
    <description>Java SDK for Serverless Workflow Specification</description>

    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
        </dependency>
        <!-- test -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.jsonschema2pojo</groupId>
                <artifactId>jsonschema2pojo-maven-plugin</artifactId>
                <configuration>
                    <sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory>
                    <targetPackage>io.serverlessworkflow.api.types</targetPackage>
                    <outputDirectory>${project.build.directory}/generated-sources/src/main/java</outputDirectory>
                    <includeJsr303Annotations>true</includeJsr303Annotations>
                    <generateBuilders>true</generateBuilders>
                    <initializeCollections>false</initializeCollections>
                    <includeAdditionalProperties>false</includeAdditionalProperties>
                    <includeToString>false</includeToString>
                    <includeHashcodeAndEquals>false</includeHashcodeAndEquals>
                    <includeConstructors>true</includeConstructors>
                    <constructorsRequiredPropertiesOnly>true</constructorsRequiredPropertiesOnly>
                    <serializable>true</serializable>
                    <targetVersion>${java.version}</targetVersion>
                    <usePrimitives>true</usePrimitives>
                    <useJakartaValidation>true</useJakartaValidation>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <phase>generate-sources</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <configuration>
                    <checkstyleRules>
                        <module name="Checker">
                            <module name="RegexpHeader">
                                <property name="header" value="${checkstyle.header.template}" />
                                <property name="fileExtensions" value="${checkstyle.header.extensions}" />
                            </module>
                            <module name="TreeWalker">
                                <module name="RegexpSinglelineJava">
                                    <property name="format" value="@author" />
                                    <property name="message" value="No @author tag allowed" />
                                </module>
                            </module>
                        </module>
                    </checkstyleRules>
                    <outputFile>${project.build.directory}/checkstyle.log</outputFile>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                    <includeResources>true</includeResources>
                    <includeTestResources>true</includeTestResources>
                    <consoleOutput>false</consoleOutput>
                    <failsOnError>false</failsOnError>
                    <logViolationsToConsole>${checkstyle.logViolationsToConsole}</logViolationsToConsole>
                    <failOnViolation>${checkstyle.failOnViolation}</failOnViolation>
                    <sourceDirectories>
                        <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                        <sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
                    </sourceDirectories>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.spotify.fmt</groupId>
                <artifactId>fmt-maven-plugin</artifactId>
                <configuration>
                    <sourceDirectory>src/main/java</sourceDirectory>
                    <testSourceDirectory>src/test/java</testSourceDirectory>
                    <verbose>false</verbose>
                    <filesNamePattern>.*\.java</filesNamePattern>
                    <skip>false</skip>
                    <skipSortingImports>false</skipSortingImports>
                    <style>google</style>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>format</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-jar-plugin</artifactId>
               <executions>
                   <execution>
                       <goals>
                           <goal>test-jar</goal>
                       </goals>
                   </execution>
               </executions>
           </plugin>
        </plugins>
    </build>
</project>
