/**
 * Copyright 2013-2026 the original author or authors from the JHipster project.
 *
 * This file is part of the JHipster project, see https://www.jhipster.tech/
 * for more information.
 *
 * 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
 *
 *      https://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.
 */
export const mavenProfileContent = (data) => {
    return `
            <!-- force dependency version as used bonsai add-on as of now only supports 7.10.x -->
            <!-- https://github.com/jhipster/generator-jhipster/issues/18650 -->
            <properties>
                <bonsai.elasticsearch.version>7.10.2</bonsai.elasticsearch.version>
            </properties>
            <dependencyManagement>
                <dependencies>
                    <dependency>
                        <groupId>org.elasticsearch.client</groupId>
                        <artifactId>elasticsearch-rest-client</artifactId>
                        <version>\${bonsai.elasticsearch.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.elasticsearch.client</groupId>
                        <artifactId>elasticsearch-rest-high-level-client</artifactId>
                        <version>\${bonsai.elasticsearch.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.elasticsearch</groupId>
                        <artifactId>elasticsearch</artifactId>
                        <version>\${bonsai.elasticsearch.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.elasticsearch.plugin</groupId>
                        <artifactId>transport-netty4-client</artifactId>
                        <version>\${bonsai.elasticsearch.version}</version>
                    </dependency>
                </dependencies>
            </dependencyManagement>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.liquibase</groupId>
                        <artifactId>liquibase-maven-plugin</artifactId>
                        <configuration combine.self="override">
                            <changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
                            <diffChangeLogFile>src/main/resources/config/liquibase/changelog/\${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
                            <driver></driver>
                            <url>\${env.JDBC_DATABASE_URL}</url>
                            <defaultSchemaName></defaultSchemaName>
                            <username>\${env.JDBC_DATABASE_USERNAME}</username>
                            <password>\${env.JDBC_DATABASE_PASSWORD}</password>${data.prodHibernateDialect && data.hibernateNamingPhysicalStrategy && data.hibernateNamingImplicitStrategy ?
        `
                            <referenceUrl>hibernate:spring:${data.packageName}.domain?dialect=${data.prodHibernateDialect}&amp;hibernate.physical_naming_strategy=${data.hibernateNamingPhysicalStrategy}&amp;hibernate.implicit_naming_strategy=${data.hibernateNamingImplicitStrategy}</referenceUrl>`
        : ''}
                            <verbose>true</verbose>
                            <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-clean-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>clean-artifacts</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>clean</goal>
                                </goals>
                                <configuration>
                                    <excludeDefaultDirectories>true</excludeDefaultDirectories>
                                    <filesets>
                                        <fileset>
                                            <directory>target</directory>
                                            <excludes>
                                                <exclude>*.jar</exclude>
                                            </excludes>
                                            <followSymlinks>false</followSymlinks>
                                        </fileset>
                                        <fileset>
                                            <directory>node_modules</directory>
                                            <followSymlinks>false</followSymlinks>
                                        </fileset>
                                    </filesets>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
`;
};
