<?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>flexio-commons</artifactId>
        <groupId>io.flexio.commons</groupId>
        <version>1.4.0</version>
        <relativePath>../</relativePath>
    </parent>

    <artifactId>flexio-graylog-client</artifactId>
    <name>Flexio Graylog Client</name>

    <dependencies>
        <dependency>
            <groupId>org.codingmatters.rest</groupId>
            <artifactId>cdm-rest-client-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.codingmatters.rest</groupId>
            <artifactId>cdm-rest-client-okhttp</artifactId>
        </dependency>

        <dependency>
            <groupId>org.codingmatters.value.objects</groupId>
            <artifactId>cdm-value-objects-values</artifactId>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>compile</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <!-- use -P\!skipGraylogTests to disable this profile-->
            <id>skipGraylogTests</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <skipTests>true</skipTests>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codingmatters.rest</groupId>
                <artifactId>cdm-rest-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>api-types-gen</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate-api-types</goal>
                        </goals>
                        <configuration>
                            <destination-package>io.flexio.commons.graylog.api</destination-package>
                            <api-spec-file>${project.basedir}/src/main/resources/graylog-api.raml</api-spec-file>
                        </configuration>
                    </execution>

                    <execution>
                        <id>api-client-gen</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate-client-side</goal>
                        </goals>
                        <configuration>
                            <destination-package>io.flexio.commons.graylog.api.client</destination-package>
                            <api-spec-file>${project.basedir}/src/main/resources/graylog-api.raml</api-spec-file>
                            <types-package>io.flexio.commons.graylog.api.types</types-package>
                            <api-package>io.flexio.commons.graylog.api</api-package>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>target/generated-sources</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>