<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>io.skullabs.kikaha</groupId>
        <version>2.1.6.Final</version>
        <artifactId>kikaha-parent</artifactId>
    </parent>

    <artifactId>kikaha-project</artifactId>
    <name>Kikaha: Simple Project (BOM)</name>
    <description>Kikaha: Simple Project (BOM)</description>
    <packaging>pom</packaging>

    <properties>
        <!-- Configs -->
        <config.encoding>UTF-8</config.encoding>
        <!-- Kikaha Maven Plugins -->
        <config.plugins.aws.lambda.force>false</config.plugins.aws.lambda.force>
        <config.plugins.aws.lambda.enabled>false</config.plugins.aws.lambda.enabled>
        <config.plugins.aws.lambda.create-rest-api>true</config.plugins.aws.lambda.create-rest-api>
        <config.plugins.aws.lambda.bucket>${config.plugins.aws.s3.bucket}</config.plugins.aws.lambda.bucket>
        <config.plugins.aws.lambda.region>us-east-1</config.plugins.aws.lambda.region>
        <config.plugins.aws.lambda.memory>128</config.plugins.aws.lambda.memory>
        <config.plugins.aws.s3.enabled>${config.plugins.aws.lambda.enabled}</config.plugins.aws.s3.enabled>
        <config.plugins.aws.s3.useCodeDeploy>false</config.plugins.aws.s3.useCodeDeploy>
        <config.plugins.aws.s3.codeDeployFolder>META-INF/aws-code-deploy/</config.plugins.aws.s3.codeDeployFolder>
        <config.plugins.aws.s3.codeDeployApplicationName>${project.groupId}-${project.artifactId}-${project.version}.zip</config.plugins.aws.s3.codeDeployApplicationName>
        <config.plugins.aws.s3.codeDeployDeploymentGroupName>production</config.plugins.aws.s3.codeDeployDeploymentGroupName>
        <config.plugins.aws.s3.region>${config.plugins.aws.lambda.region}</config.plugins.aws.s3.region>
        <config.plugins.aws.s3.bucket>default-bucket</config.plugins.aws.s3.bucket>
        <config.plugins.jar.enabled>${config.plugins.aws.s3.enabled}</config.plugins.jar.enabled>
        <config.plugins.package.enabled>false</config.plugins.package.enabled>
        <config.plugins.maven.deploy.skip>true</config.plugins.maven.deploy.skip>
        <config.plugins.rocker.skip>true</config.plugins.rocker.skip>
        <config.plugins.rocker.template-dir>${config.dir.web}</config.plugins.rocker.template-dir>
        <config.plugins.rocker.output-dir>${project.build.directory}/generated-sources/rocker</config.plugins.rocker.output-dir>
        <config.plugins.aws.lambda.role>arn:invalid</config.plugins.aws.lambda.role>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.skullabs.kikaha</groupId>
            <version>2.1.6.Final</version>
            <artifactId>kikaha-injection-processor</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>io.skullabs.kikaha</groupId>
                    <artifactId>kikaha-injection</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- configure kikaha-maven-plugin -->
            <plugin>
                <groupId>io.skullabs.kikaha</groupId>
                <artifactId>kikaha-maven-plugin</artifactId>
                <version>2.1.6.Final</version>
                <inherited>true</inherited>
                <executions>
                    <execution>
                        <id>kikaha-install-jar</id>
                        <phase>install</phase>
                        <goals><goal>jar</goal></goals>
                        <configuration>
                            <enabled>${config.plugins.jar.enabled}</enabled>
                        </configuration>
                    </execution>
                    <execution>
                        <id>kikaha-install-package</id>
                        <phase>install</phase>
                        <goals><goal>package</goal></goals>
                        <configuration>
                            <enabled>${config.plugins.package.enabled}</enabled>
                        </configuration>
                    </execution>
                    <execution>
                        <id>kikaha-deploy-aws-s3</id>
                        <phase>deploy</phase>
                        <goals><goal>deploy-on-aws-s3</goal></goals>
                        <configuration>
                            <enabled>${config.plugins.aws.s3.enabled}</enabled>
                            <s3Bucket>${config.plugins.aws.s3.bucket}</s3Bucket>
                            <regionName>${config.plugins.aws.s3.region}</regionName>
                            <useCodeDeploy>${config.plugins.aws.s3.useCodeDeploy}</useCodeDeploy>
                            <codeDeployFolder>${config.plugins.aws.s3.codeDeployFolder}</codeDeployFolder>
                            <codeDeployDeploymentGroupName>${config.plugins.aws.s3.codeDeployDeploymentGroupName}</codeDeployDeploymentGroupName>
                            <codeDeployApplicationName>${config.plugins.aws.s3.codeDeployApplicationName}</codeDeployApplicationName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>kikaha-deploy-aws-lambda</id>
                        <phase>deploy</phase>
                        <goals><goal>deploy-on-aws-lambda</goal></goals>
                        <configuration>
                            <enabled>${config.plugins.aws.lambda.enabled}</enabled>
                            <s3Bucket>${config.plugins.aws.lambda.bucket}</s3Bucket>
                            <lambdaRole>${config.plugins.aws.lambda.role}</lambdaRole>
                            <createRestAPI>${config.plugins.aws.lambda.create-rest-api}</createRestAPI>
                            <force>${config.plugins.aws.lambda.force}</force>
                            <regionName>${config.plugins.aws.lambda.region}</regionName>
                            <lambdaMemory>${config.plugins.aws.lambda.memory}</lambdaMemory>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <jvmArgs>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</jvmArgs>
                    <webResourcesPath>${config.dir.web}</webResourcesPath>
                </configuration>
            </plugin>

            <!-- Rocker Plugin -->
            <plugin>
                <groupId>com.fizzed</groupId>
                <artifactId>rocker-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-rocker-templates</id>
                        <phase>generate-sources</phase>
                        <goals><goal>generate</goal></goals>
                        <configuration>
                            <skip>${config.plugins.rocker.skip}</skip>
                            <outputDirectory>${config.plugins.rocker.output-dir}</outputDirectory>
                            <templateDirectory>${config.plugins.rocker.template-dir}</templateDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals><goal>add-source</goal></goals>
                        <configuration>
                            <skip>${config.plugins.rocker.skip}</skip>
                            <sources>
                                <source>${config.plugins.rocker.output-dir}</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.7</version>
                    <executions>
                        <execution>
                            <id>default-deploy</id>
                            <phase>deploy</phase>
                            <goals>
                                <goal>deploy</goal>
                            </goals>
                            <configuration>
                                <skip>${config.plugins.maven.deploy.skip}</skip>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
      <profile>
        <id>maven-deploy</id>
        <properties>
          <config.plugins.maven.deploy.skip>false</config.plugins.maven.deploy.skip>
        </properties>
      </profile>
    </profiles>

</project>
