<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2015 herd contributors

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.finra.herd</groupId>
    <artifactId>herd-docs</artifactId>
    <version>0.158.0</version>
  </parent>
  <groupId>org.finra.herd</groupId>
  <artifactId>herd-docs-swagger-new</artifactId>
  <version>0.158.0</version>
  <name>herd docs swagger new</name>
  <description>This is the swagger REST documentation project.</description>
  <url>http://finraos.github.io/herd/</url>
  <licenses>
    <license>
      <name>The Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>
  <properties>
    <herd.swagger.yamlFile>herd.swagger-new.yaml</herd.swagger.yamlFile>
    <npm.bin.path>npm</npm.bin.path>
  </properties>
  <build>
    <plugins>
      <plugin>
        <groupId>org.finra.herd</groupId>
        <artifactId>herd-swaggergen-maven-plugin-new</artifactId>
        <version>${project.version}</version>
        <executions>
          <execution>
            <id>generate-herd.swagger</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>herd-swaggergen</goal>
            </goals>
            <configuration>
              <restJavaPackage>org.finra.herd.rest</restJavaPackage>
              <modelJavaPackage>org.finra.herd.model.api.xml</modelJavaPackage>
              <modelErrorClassName>ErrorInformation</modelErrorClassName>
              <outputFilename>herd.swagger-new.yaml</outputFilename>
              <title>herd</title>
              <basePath>/herd-app/rest</basePath>
              <xsdName>herd.xsd</xsdName>
              <authTypes>
                <param>basic</param>
                <param>oauth2</param>
              </authTypes>
            </configuration>
          </execution>
          <execution>
            <id>generate-herd.swagger.ext</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>herd-swaggergen</goal>
            </goals>
            <configuration>
              <restJavaPackage>org.finra.herd.rest</restJavaPackage>
              <modelJavaPackage>org.finra.herd.model.api.xml</modelJavaPackage>
              <modelErrorClassName>ErrorInformation</modelErrorClassName>
              <outputFilename>herd.swagger-new.ext.yaml</outputFilename>
              <title>herd-external</title>
              <basePath>/herd-app/rest</basePath>
              <xsdName>herd.xsd</xsdName>
              <authTypes>
                <param>basic</param>
                <param>oauth2</param>
              </authTypes>
              <applyOperationsFilter>true</applyOperationsFilter>
              <includeOperations>
                <param>BusinessObjectData.checkBusinessObjectDataAvailability</param>
                <param>BusinessObjectData.generateBusinessObjectDataDdl</param>
                <param>BusinessObjectData.getBusinessObjectData</param>
                <param>BusinessObjectData.getBusinessObjectDataVersions</param>
                <param>BusinessObjectData.searchBusinessObjectData</param>
                <param>BusinessObjectDefinition.getBusinessObjectDefinition</param>
                <param>BusinessObjectFormat.generateBusinessObjectFormatDdl</param>
                <param>BusinessObjectFormat.getBusinessObjectFormats</param>
                <param>BusinessObjectFormat.getBusinessObjectFormat</param>
                <param>CurrentUser.getCurrentUser</param>
                <param>ExpectedPartitionValue.getExpectedPartitionValues</param>
                <param>ExpectedPartitionValue.getExpectedPartitionValue</param>
                <param>Namespace.getNamespace</param>
                <param>PartitionKeyGroup.getPartitionKeyGroups</param>
                <param>PartitionKeyGroup.getPartitionKeyGroup</param>
                <param>Storage.getStorage</param>
              </includeOperations>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>herd-rest</artifactId>
            <version>${project.version}</version>
          </dependency>
          <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>herd-rest</artifactId>
            <version>${project.version}</version>
            <classifier>sources</classifier>
          </dependency>
          <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${javax.servlet.version}</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/src/swagger-ui-master</outputDirectory>
              <resources>
                <resource>
                  <directory>src/swagger-ui-master</directory>
                  <filtering>true</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>npm-install</id>
            <phase>compile</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <workingDirectory>${project.build.directory}/src/swagger-ui-master</workingDirectory>
              <executable>${npm.bin.path}</executable>
              <arguments>
                <argument>install</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>npm-build</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <workingDirectory>${project.build.directory}/src/swagger-ui-master</workingDirectory>
              <executable>${npm.bin.path}</executable>
              <arguments>
                <argument>run</argument>
                <argument>build</argument>
              </arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <phase>prepare-package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>src/assembly/assets.xml</descriptor>
              </descriptors>
              <appendAssemblyId>false</appendAssemblyId>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>ews</id>
      <properties>
        <herd.swagger.yamlFile>herd.swagger-new.ext.yaml</herd.swagger.yamlFile>
      </properties>
    </profile>
  </profiles>
</project>
