<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>io.apicurio</groupId>
        <artifactId>apicurio-registry-examples</artifactId>
        <version>2.6.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>apicurio-registry-examples-quarkus-auth</artifactId>

    <properties>
        <maven.compiler.target>11</maven.compiler.target>
        <maven.compiler.source>11</maven.compiler.source>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
        <quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
        <quarkus.platform.version>2.7.5.Final</quarkus.platform.version>
        <quarkus-plugin.version>2.7.5.Final</quarkus-plugin.version>

        <avro.version>1.10.0</avro.version>

    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>${quarkus.platform.group-id}</groupId>
                <artifactId>${quarkus.platform.artifact-id}</artifactId>
                <version>${quarkus.platform.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

        <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
        </dependency>
        <dependency>
            <groupId>io.apicurio</groupId>
            <artifactId>apicurio-registry-maven-plugin</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-apicurio-registry-avro</artifactId>
        </dependency>

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-resteasy-jackson</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.github.java-json-tools</groupId>
                    <artifactId>jackson-coreutils</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-smallrye-health</artifactId>
        </dependency>
        <dependency>
            <groupId>com.github.java-json-tools</groupId>
            <artifactId>jackson-coreutils</artifactId>
            <version>2.0</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-smallrye-reactive-messaging-kafka</artifactId>
        </dependency>

        <dependency>
            <groupId>io.strimzi</groupId>
            <artifactId>kafka-oauth-client</artifactId>
            <version>0.7.2</version>
        </dependency>

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-config-yaml</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-maven-plugin</artifactId>
                <version>${quarkus-plugin.version}</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <goals>
                            <goal>build</goal>
                            <goal>generate-code</goal>
                            <goal>generate-code-tests</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                        <maven.home>${maven.home}</maven.home>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>avro</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.avro</groupId>
                        <artifactId>avro-maven-plugin</artifactId>
                        <version>${avro.version}</version>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>schema</goal>
                                </goals>
                                <configuration>
                                    <sourceDirectory>${project.basedir}/src/main/resources/avro/schema/</sourceDirectory>
                                    <outputDirectory>${project.basedir}/src/main/java/</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>upload</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.apicurio</groupId>
                        <artifactId>apicurio-registry-maven-plugin</artifactId>
                        <version>${project.version}</version>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>register</goal>
                                </goals>
                                <configuration>
                                    <registryUrl>http://localhost:8181/apis/registry/v2</registryUrl>
                                    <artifactType>AVRO</artifactType>
                                    <artifacts>
                                        <events-value>${project.basedir}/src/main/resources/avro/schema/event.avsc</events-value>
                                    </artifacts>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>test</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.apicurio</groupId>
                        <artifactId>apicurio-registry-maven-plugin</artifactId>
                        <version>${project.version}</version>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>test-update</goal>
                                </goals>
                                <configuration>
                                    <registryUrl>http://localhost:8181/apis/registry/v2</registryUrl>
                                    <artifactType>AVRO</artifactType>
                                    <artifacts>
                                        <events-value>${project.basedir}/src/main/resources/avro/schema/event.avsc</events-value>
                                    </artifacts>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>download</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.apicurio</groupId>
                        <artifactId>apicurio-registry-maven-plugin</artifactId>
                        <version>${project.version}</version>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>download</goal>
                                </goals>
                                <configuration>
                                    <registryUrl>http://localhost:8181/apis/registry/v2</registryUrl>
                                    <ids>
                                        <param1>events-value</param1>
                                    </ids>
                                    <outputDirectory>${project.build.directory}</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
