import { SERVER_MAIN_RES_DIR } from '../generator-constants.mjs';
import { javaMainPackageTemplatesBlock } from '../server/support/index.mjs';
export const entityFiles = {
    dbChangelog: [
        {
            condition: ctx => !ctx.skipDbChangelog,
            path: SERVER_MAIN_RES_DIR,
            templates: [
                {
                    file: 'config/cql/changelog/added_entity.cql',
                    renameTo: ctx => `config/cql/changelog/${ctx.changelogDate}_added_entity_${ctx.entityClass}.cql`,
                },
            ],
        },
    ],
    server: [
        {
            ...javaMainPackageTemplatesBlock('_entityPackage_'),
            templates: ['domain/_persistClass_.java.jhi.spring_data_cassandra'],
        },
    ],
};
export function cleanupCassandraEntityFilesTask() { }
export default async function writeEntityCassandraFiles({ application, entities }) {
    for (const entity of entities.filter(entity => !entity.builtIn && !entity.skipServer)) {
        await this.writeFiles({
            sections: entityFiles,
            context: { ...application, ...entity },
        });
    }
}
