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

    <name>SmallRye: OpenAPI UI</name>
    
    <properties>
        <swagger-ui.version>3.36.2</swagger-ui.version>
        <swagger-ui-theme.version>3.0.1</swagger-ui-theme.version>
        <path.swagger-ui>openapi-ui</path.swagger-ui>
    </properties>
    
    <dependencies>
        <!-- Tests -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    
    <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>
            <!-- Make sure the template is available for external usage -->
            <resource>
                <directory>${basedir}/src/main/resources/template</directory>
                <targetPath>${project.build.directory}/classes/META-INF/resources/template</targetPath>
                <filtering>false</filtering>
                <includes>
                    <include>*.html</include>
                </includes>
            </resource>
            <!-- Also included index.html in case a template is not used -->
            <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>
                    <!-- We download the index.html just to compare to our custom template one. -->
                    <execution>
                        <id>install-swagger-ui-html</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>https://unpkg.com/swagger-ui-dist@${swagger-ui.version}/index.html</url>
                            <unpack>false</unpack>
                            <outputDirectory>${project.build.directory}/original/</outputDirectory>
                            <md5>3c09b175732f72a887bb60cafc9571cb</md5>
                        </configuration>
                    </execution>
                    
                    <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>bc068a76c80f75bb497dc99d6f86afad</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>aed52866dc7d571064dbc72e3f60de18</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>97f5f477f101673dd65969260f1b17bb</md5>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-swagger-ui-theme1</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>    
                    <execution>
                        <id>install-swagger-ui-theme2</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-flattop.css</url>
                            <unpack>false</unpack>
                            <outputDirectory>${project.build.directory}/classes/META-INF/resources/${path.swagger-ui}</outputDirectory>
                            <md5>fa35bec1fbac3be81bbf39ba265e2513</md5>
                        </configuration>
                    </execution>    
                    <execution>
                        <id>install-swagger-ui-theme3</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-material.css</url>
                            <unpack>false</unpack>
                            <outputDirectory>${project.build.directory}/classes/META-INF/resources/${path.swagger-ui}</outputDirectory>
                            <md5>e08a28fa9075553954222782f7219068</md5>
                        </configuration>
                    </execution>    
                    <execution>
                        <id>install-swagger-ui-theme4</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-monokai.css</url>
                            <unpack>false</unpack>
                            <outputDirectory>${project.build.directory}/classes/META-INF/resources/${path.swagger-ui}</outputDirectory>
                            <md5>893e2f09f99768682fdddbfc42713fd0</md5>
                        </configuration>
                    </execution>    
                    <execution>
                        <id>install-swagger-ui-theme5</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-muted.css</url>
                            <unpack>false</unpack>
                            <outputDirectory>${project.build.directory}/classes/META-INF/resources/${path.swagger-ui}</outputDirectory>
                            <md5>198359070aa509736bf1eb5b9d8441b0</md5>
                        </configuration>
                    </execution>    
                    <execution>
                        <id>install-swagger-ui-theme6</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-newspaper.css</url>
                            <unpack>false</unpack>
                            <outputDirectory>${project.build.directory}/classes/META-INF/resources/${path.swagger-ui}</outputDirectory>
                            <md5>6ea2511178d892b5933c233785d2f3ac</md5>
                        </configuration>
                    </execution>    
                    <execution>
                        <id>install-swagger-ui-theme7</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-outline.css</url>
                            <unpack>false</unpack>
                            <outputDirectory>${project.build.directory}/classes/META-INF/resources/${path.swagger-ui}</outputDirectory>
                            <md5>eb3609706e0f296148a5c031f985fb17</md5>
                        </configuration>
                    </execution>
                            
                </executions>
            </plugin>
        </plugins>
        
    </build>
</project>
