import { moveToJavaPackageSrcDir, moveToJavaPackageTestDir } from '../java/support/index.js';
import { GRADLE_BUILD_SRC_MAIN_DIR, SERVER_MAIN_SRC_DIR, SERVER_TEST_SRC_DIR } from '../generator-constants.js';
const files = {
    cacheFiles: [
        {
            condition: data => data.buildToolGradle,
            templates: [`${GRADLE_BUILD_SRC_MAIN_DIR}/jhipster.spring-cache-conventions.gradle`],
        },
        {
            path: `${SERVER_MAIN_SRC_DIR}_package_/`,
            renameTo: moveToJavaPackageSrcDir,
            templates: ['config/CacheConfiguration.java'],
        },
        {
            condition: data => data.cacheProviderInfinispan,
            path: `${SERVER_MAIN_SRC_DIR}_package_/`,
            renameTo: moveToJavaPackageSrcDir,
            templates: ['config/CacheFactoryConfiguration.java'],
        },
        {
            condition: data => data.cacheProviderRedis,
            path: `${SERVER_TEST_SRC_DIR}_package_/`,
            renameTo: moveToJavaPackageTestDir,
            templates: [
                'config/EmbeddedRedis.java',
                'config/RedisTestContainer.java',
                'config/RedisTestContainersSpringContextCustomizerFactory.java',
            ],
        },
    ],
};
export default async function writeTask({ application }) {
    await this.writeFiles({
        sections: files,
        context: application,
    });
}
