<?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>dev.truewinter</groupId>
        <artifactId>SnowMailProject</artifactId>
        <version>0.3.3</version>
    </parent>

    <groupId>dev.truewinter.snowmail</groupId>
    <artifactId>api</artifactId>

    <dependencies>
        <dependency>
            <groupId>dev.truewinter</groupId>
            <artifactId>PluginManager</artifactId>
            <version>0.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>2.0.11</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.16.1</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>24.0.1</version>
        </dependency>
        <dependency>
            <groupId>at.favre.lib</groupId>
            <artifactId>bcrypt</artifactId>
            <version>0.10.2</version>
        </dependency>
        <!-- There's a lot more information available about v4 than v5, so sticking with that for now -->
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-sync</artifactId>
            <version>4.11.2</version>
        </dependency>
    </dependencies>

    <build>
        <finalName>${project.artifactId}-${project.version}</finalName>
        <plugins>
            <plugin>
                <groupId>cz.habarta.typescript-generator</groupId>
                <artifactId>typescript-generator-maven-plugin</artifactId>
                <version>3.2.1263</version>
                <executions>
                    <execution>
                        <id>public</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <jsonLibrary>jackson2</jsonLibrary>
                            <jackson2Configuration>
                                <view>dev.truewinter.snowmail.api.pojo.Views$Public</view>
                            </jackson2Configuration>
                            <classes>
                                <class>dev.truewinter.snowmail.api.pojo.objects.Account</class>
                                <class>dev.truewinter.snowmail.api.pojo.objects.Form</class>
                            </classes>
                            <customTypeMappings>
                                <mapping>org.bson.types.ObjectId:string</mapping>
                            </customTypeMappings>
                            <nullableAnnotations>
                                <nullableAnnotation>dev.truewinter.snowmail.api.NullableField</nullableAnnotation>
                            </nullableAnnotations>
                            <nullabilityDefinition>undefinedInlineUnion</nullabilityDefinition>
                            <outputFile>../npm/types/public.d.ts</outputFile>
                            <outputKind>module</outputKind>
                        </configuration>
                    </execution>
                    <execution>
                        <id>all</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <jsonLibrary>jackson2</jsonLibrary>
                            <classes>
                                <class>dev.truewinter.snowmail.api.pojo.objects.Account</class>
                                <class>dev.truewinter.snowmail.api.pojo.objects.Form</class>
                            </classes>
                            <customTypeMappings>
                                <mapping>org.bson.types.ObjectId:string</mapping>
                            </customTypeMappings>
                            <nullableAnnotations>
                                <nullableAnnotation>dev.truewinter.snowmail.api.NullableField</nullableAnnotation>
                            </nullableAnnotations>
                            <nullabilityDefinition>undefinedInlineUnion</nullabilityDefinition>
                            <outputFile>../types/java.d.ts</outputFile>
                            <outputKind>module</outputKind>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <outputFile>../build/${project.artifactId}-${project.version}.jar</outputFile>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <shadedArtifactAttached>false</shadedArtifactAttached>
                            <minimizeJar>false</minimizeJar>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.deploy.skip>false</maven.deploy.skip>
    </properties>

</project>