<?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>
        <groupId>io.smallrye</groupId>
        <artifactId>smallrye-open-api-ui-parent</artifactId>
        <version>2.0.12</version>
    </parent>
    
    <artifactId>smallrye-open-api-ui</artifactId>

    <name>SmallRye: OpenAPI UI</name>
    
    <properties>
        <swagger-ui.version>3.35.1</swagger-ui.version>
        <swagger-ui-theme.version>3.0.1</swagger-ui-theme.version>
        <path.swagger-ui>openapi-ui</path.swagger-ui>
    
    </properties>
    
    <build>            
        <!-- Copy all web content files META-INF folder, and push it though a filter to replace maven properties -->
        <resources>
            <resource>
                <directory>${basedir}/src/main/resources</directory>
            </resource>
            <resource>
                <directory>${basedir}/src/main/webapp</directory>
                <targetPath>${project.build.directory}/classes/META-INF/resources/${path.swagger-ui}</targetPath>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.html</include>
                </includes>
            </resource>
            <resource>
                <directory>${basedir}/src/main/webapp</directory>
                <targetPath>${project.build.directory}/classes/META-INF/resources/${path.swagger-ui}</targetPath>
                <filtering>false</filtering>
                <excludes>
                    <exclude>**/*.html</exclude>
                </excludes>
            </resource>
        </resources>
        
        <plugins>
            <!-- So we don't have to keep a version of these javascript libs in our repo -->
            <plugin>
                <groupId>com.googlecode.maven-download-plugin</groupId>
                <artifactId>download-maven-plugin</artifactId>
                <version>1.6.0</version>
                <executions>
                        <execution>
                            <id>install-swagger-ui-css</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>wget</goal>
                            </goals>
                            <configuration>
                                <url>https://unpkg.com/swagger-ui-dist@${swagger-ui.version}/swagger-ui.css</url>
                                <unpack>false</unpack>
                                <outputDirectory>${project.build.directory}/classes/META-INF/resources/${path.swagger-ui}</outputDirectory>
                                <md5>c07314911af9efbefe6aa835d20a16e4</md5>
                            </configuration>
                        </execution>
                        <execution>
                            <id>install-swagger-ui</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>wget</goal>
                            </goals>
                            <configuration>
                                <url>https://unpkg.com/swagger-ui-dist@${swagger-ui.version}/swagger-ui-bundle.js</url>
                                <unpack>false</unpack>
                                <outputDirectory>${project.build.directory}/classes/META-INF/resources/${path.swagger-ui}</outputDirectory>
                                <md5>b75084b8f16f5a282d9880e07f30c163</md5>
                            </configuration>
                        </execution>
                        <execution>
                            <id>install-swagger-ui-standalone-preset</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>wget</goal>
                            </goals>
                            <configuration>
                                <url>https://unpkg.com/swagger-ui-dist@${swagger-ui.version}/swagger-ui-standalone-preset.js</url>
                                <unpack>false</unpack>
                                <outputDirectory>${project.build.directory}/classes/META-INF/resources/${path.swagger-ui}</outputDirectory>
                                <md5>f76577cd29dcfd05d77573be78cbe3a1</md5>
                            </configuration>
                        </execution>
                        <execution>
                            <id>install-swagger-ui-theme</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>wget</goal>
                            </goals>
                            <configuration>
                                <url>https://unpkg.com/swagger-ui-themes@${swagger-ui-theme.version}/themes/3.x/theme-feeling-blue.css</url>
                                <unpack>false</unpack>
                                <outputDirectory>${project.build.directory}/classes/META-INF/resources/${path.swagger-ui}</outputDirectory>
                                <md5>043718e5194b38bcbec6f28e4aeaf614</md5>
                            </configuration>
                        </execution>
                        
                </executions>
            </plugin>
        </plugins>
        
    </build>
</project>
