<?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.langchain4j</groupId>
        <artifactId>langchain4j-parent</artifactId>
        <version>0.36.2</version>
        <relativePath>../langchain4j-parent/pom.xml</relativePath>
    </parent>

    <artifactId>langchain4j-elasticsearch</artifactId>
    <name>LangChain4j :: Integration :: Elasticsearch</name>

    <properties>
        <!-- For tests only -->
        <!-- You can run the tests using
        # Elasticsearch Cloud
        mvn verify -DELASTICSEARCH_CLOUD_URL=https://URL.elastic-cloud.com -DELASTICSEARCH_CLOUD_API_KEY=THE_KEY
        # Elasticsearch running already Locally
        mvn verify -DELASTICSEARCH_LOCAL_URL=https://localhost:9200 -DELASTICSEARCH_LOCAL_PASSWORD=changeme
        # Elasticsearch started by Testcontainers
        mvn verify
        # Elasticsearch started by Testcontainers with a specific password
        mvn verify -DELASTICSEARCH_LOCAL_PASSWORD=changeme
        -->
        <ELASTICSEARCH_CLOUD_URL />
        <ELASTICSEARCH_CLOUD_API_KEY />
        <ELASTICSEARCH_LOCAL_URL />
        <ELASTICSEARCH_LOCAL_PASSWORD>changeme</ELASTICSEARCH_LOCAL_PASSWORD>
    </properties>

    <dependencies>
        <dependency>
            <groupId>dev.langchain4j</groupId>
            <artifactId>langchain4j-core</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>co.elastic.clients</groupId>
            <artifactId>elasticsearch-java</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>jakarta.json</groupId>
                    <artifactId>jakarta.json-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>jakarta.json</groupId>
            <artifactId>jakarta.json-api</artifactId>
            <version>2.0.2</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <dependency>
            <groupId>dev.langchain4j</groupId>
            <artifactId>langchain4j-core</artifactId>
            <version>${project.version}</version>
            <classifier>tests</classifier>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- junit-jupiter-params should be declared explicitly
        to run parameterized tests inherited from EmbeddingStore*IT-->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>dev.langchain4j</groupId>
            <artifactId>langchain4j-embeddings-all-minilm-l6-v2-q</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>elasticsearch</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j2-impl</artifactId>
            <version>2.22.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.17.0</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <environmentVariables>
                        <ELASTICSEARCH_CLOUD_URL>${ELASTICSEARCH_CLOUD_URL}</ELASTICSEARCH_CLOUD_URL>
                        <ELASTICSEARCH_CLOUD_API_KEY>${ELASTICSEARCH_CLOUD_API_KEY}</ELASTICSEARCH_CLOUD_API_KEY>
                        <ELASTICSEARCH_LOCAL_URL>${ELASTICSEARCH_LOCAL_URL}</ELASTICSEARCH_LOCAL_URL>
                        <ELASTICSEARCH_LOCAL_PASSWORD>${ELASTICSEARCH_LOCAL_PASSWORD}</ELASTICSEARCH_LOCAL_PASSWORD>
                    </environmentVariables>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <licenses>
        <license>
            <name>Apache-2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

</project>
