<?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>

    <groupId>io.github.blueprint-platform</groupId>
    <artifactId>openapi-generics</artifactId>
    <version>1.1.0</version>
    <packaging>pom</packaging>

    <name>openapi-generics (aggregator)</name>
    <description>
        OpenAPI Generics platform aggregator. Defines contract, projection, and generation modules
        for deterministic, generics-aware API lifecycle.
    </description>
    <url>https://github.com/blueprint-platform/openapi-generics</url>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>https://opensource.org/licenses/MIT</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/blueprint-platform/openapi-generics</url>
        <connection>scm:git:https://github.com/blueprint-platform/openapi-generics.git</connection>
        <developerConnection>scm:git:ssh://git@github.com:blueprint-platform/openapi-generics.git</developerConnection>
        <tag>v1.1.0</tag>
    </scm>

    <developers>
        <developer>
            <id>bsayli</id>
            <name>Baris Sayli</name>
            <url>https://github.com/bsayli</url>
            <roles>
                <role>creator</role>
                <role>maintainer</role>
            </roles>
        </developer>
    </developers>

    <!-- CENTRAL PUBLISH TARGET -->
    <distributionManagement>
        <repository>
            <id>central</id>
            <name>Central Repository</name>
            <url>https://central.sonatype.com/api/v1/publisher</url>
        </repository>
    </distributionManagement>

    <!-- COMMON PROPERTIES -->
    <properties>
        <java.version>17</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <openapi-generics.version>1.1.0</openapi-generics.version>

        <!-- Build Plugins -->
        <maven-compiler-plugin.version>3.15.0</maven-compiler-plugin.version>
        <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
        <maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
        <flatten-maven-plugin.version>1.7.3</flatten-maven-plugin.version>
        <maven-dependency-plugin.version>3.10.0</maven-dependency-plugin.version>

        <!-- Test Plugins -->
        <maven-surefire-plugin.version>3.5.5</maven-surefire-plugin.version>
        <maven-failsafe-plugin.version>3.5.5</maven-failsafe-plugin.version>
        <jacoco-maven-plugin.version>0.8.14</jacoco-maven-plugin.version>

        <!-- Format Plugins -->
        <spotless-maven-plugin.version>3.4.0</spotless-maven-plugin.version>
        <google-java-format.version>1.35.0</google-java-format.version>

        <!-- Release Plugins -->
        <central-publishing-maven-plugin.version>0.10.0</central-publishing-maven-plugin.version>
        <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
        <maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
        <gpg.keyname>3F8AA661C1DBE5CD</gpg.keyname>
    </properties>

    <!-- MODULES -->
    <modules>
        <module>openapi-generics-contract</module>
        <module>openapi-generics-platform-bom</module>
        <module>openapi-generics-server-starter</module>
        <module>openapi-generics-java-codegen</module>
        <module>openapi-generics-java-codegen-parent</module>
    </modules>

    <build>
        <pluginManagement>
            <plugins>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <release>${java.version}</release>
                        <encoding>${project.build.sourceEncoding}</encoding>
                    </configuration>
                </plugin>

                <!-- SOURCES -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven-source-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- JAVADOC -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                    <configuration>
                        <source>${java.version}</source>
                        <encoding>${project.build.sourceEncoding}</encoding>
                        <doclint>none</doclint>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>flatten-maven-plugin</artifactId>
                    <version>${flatten-maven-plugin.version}</version>
                    <configuration>
                        <flattenMode>ossrh</flattenMode>
                    </configuration>
                    <executions>
                        <execution>
                            <id>flatten</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>flatten</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>flatten-clean</id>
                            <phase>clean</phase>
                            <goals>
                                <goal>clean</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- DEPENDENCY -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven-dependency-plugin.version}</version>
                </plugin>

                <!-- TESTS -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                </plugin>

                <!-- COVERAGE -->
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-maven-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>com.diffplug.spotless</groupId>
                    <artifactId>spotless-maven-plugin</artifactId>
                    <version>${spotless-maven-plugin.version}</version>
                    <configuration>
                        <java>
                            <includes>
                                <include>src/main/java/**/*.java</include>
                                <include>src/test/java/**/*.java</include>
                            </includes>
                            <excludes>
                                <exclude>target/**/*.java</exclude>
                            </excludes>
                            <googleJavaFormat>
                                <version>${google-java-format.version}</version>
                                <style>GOOGLE</style>
                                <reflowLongStrings>true</reflowLongStrings>
                                <reorderImports>true</reorderImports>
                                <formatJavadoc>true</formatJavadoc>
                            </googleJavaFormat>
                            <removeUnusedImports/>
                            <importOrder/>
                        </java>
                    </configuration>
                    <executions>
                        <execution>
                            <id>spotless-check</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven-deploy-plugin.version}</version>
                </plugin>

            </plugins>
        </pluginManagement>
    </build>

    <!-- CENTRAL PUBLISH PROFILE -->
    <profiles>
        <profile>
            <id>central-publish</id>

            <build>
                <plugins>

                    <!-- SIGN -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <keyname>${gpg.keyname}</keyname>
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                    </plugin>

                    <!-- CENTRAL PUBLISH -->
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${central-publishing-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>false</autoPublish>
                        </configuration>
                    </plugin>

                </plugins>
            </build>
        </profile>
    </profiles>

</project>