import { moveToJavaPackageTestDir } from '../server/support/index.mjs';
import { SERVER_TEST_SRC_DIR, SERVER_TEST_RES_DIR } from '../generator-constants.mjs';
const cucumberFiles = {
    cucumberFiles: [
        {
            path: `${SERVER_TEST_SRC_DIR}_package_/`,
            renameTo: moveToJavaPackageTestDir,
            templates: [
                'cucumber/CucumberIT.java',
                'cucumber/stepdefs/StepDefs.java',
                'cucumber/CucumberTestContextConfiguration.java',
            ],
        },
        {
            path: `${SERVER_TEST_RES_DIR}_package_/`,
            renameTo: (data, filename) => `${data.srcTestResources}${data.packageFolder}${filename}`,
            templates: ['cucumber/gitkeep'],
        },
        {
            condition: generator => generator.generateUserManagement && !generator.databaseTypeMongodb && !generator.databaseTypeCassandra,
            path: `${SERVER_TEST_SRC_DIR}_package_/`,
            renameTo: moveToJavaPackageTestDir,
            templates: ['cucumber/stepdefs/UserStepDefs.java'],
        },
        {
            condition: generator => generator.generateUserManagement && !generator.databaseTypeMongodb && !generator.databaseTypeCassandra,
            path: `${SERVER_TEST_RES_DIR}_package_/`,
            renameTo: (data, filename) => `${data.srcTestResources}${data.packageFolder}${filename}`,
            templates: ['cucumber/user.feature'],
        },
    ],
};
export default async function writeTask({ application }) {
    await this.writeFiles({
        sections: cucumberFiles,
        context: application,
    });
}
