<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://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>no.sikt</groupId>
    <artifactId>graphitron-codegen-parent</artifactId>
    <version>5.0.1</version>
  </parent>
  <artifactId>graphitron-java-codegen</artifactId>
  <version>5.0.1</version>
  <licenses>
    <license>
      <name>MIT License</name>
      <url>https://opensource.org/licenses/MIT</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <properties>
    <graphitronDirectivesSchemaDirectory>${project.build.directory}/graphitron-common/schema</graphitronDirectivesSchemaDirectory>
    <db.password>postgres</db.password>
    <testdata.schema.version>1.10</testdata.schema.version>
    <db.username>postgres</db.username>
    <db.url>jdbc:tc:postgresql:15:///sakila?TC_TMPFS=/testtmpfs:rw&amp;TC_INITSCRIPT=file:${basedir}/src/test/resources/database/postgres-sakila-schema.sql</db.url>
  </properties>
  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>graphitron-common</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>graphitron-javapoet</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>jakarta.platform</groupId>
      <artifactId>jakarta.jakartaee-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.jooq</groupId>
      <artifactId>jooq</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jooq</groupId>
      <artifactId>jooq-codegen</artifactId>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>graphitron-error-handling-javax</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.vintage</groupId>
      <artifactId>junit-vintage-engine</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.jooq</groupId>
        <artifactId>jooq-codegen-maven</artifactId>
        <executions>
          <execution>
            <id>jooq-test-code-generator</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <jdbc>
                <driver>org.testcontainers.jdbc.ContainerDatabaseDriver</driver>
                <url>${db.url}</url>
                <user>${db.username}</user>
                <password>${db.password}</password>
              </jdbc>
              <generator>
                <name>no.sikt.jooq.IdBasedGenerator</name>
                <database>
                  <includes>public.*|pg_catalog\.(pg_user|pg_user_mapping|pg_depend)</includes>
                  <schemata>
                    <schema>
                      <inputSchema>public</inputSchema>
                    </schema>
                    <schema>
                      <inputSchema>pg_catalog</inputSchema>
                    </schema>
                  </schemata>
                  <schemaVersionProvider>${testdata.schema.version}</schemaVersionProvider>
                  <includeIndexes>true</includeIndexes>
                </database>
                <target>
                  <packageName>no.sikt.graphitron.jooq.generated.testdata</packageName>
                  <directory>src/test/java</directory>
                </target>
              </generator>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${version.postgresql}</version>
          </dependency>
          <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>postgresql</artifactId>
            <version>${version.testcontainers.postgresql}</version>
          </dependency>
          <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack-graphitron-directives-schema</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
              <includeArtifactIds>graphitron-common</includeArtifactIds>
              <outputDirectory>${graphitronDirectivesSchemaDirectory}</outputDirectory>
              <includes>directives.graphqls</includes>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
