import { asWritingEntitiesTask } from '../base-application/support/task-type-inference.js';
import { javaMainPackageTemplatesBlock } from '../server/support/index.js';
const domainFiles = [
    {
        condition: ctx => ctx.entityDomainLayer,
        ...javaMainPackageTemplatesBlock('_entityPackage_'),
        templates: ['domain/_persistClass_.java.jhi.spring_data_mongodb'],
    },
];
const repositoryFiles = [
    {
        condition: ctx => !ctx.reactive && !ctx.embedded && ctx.entityPersistenceLayer,
        ...javaMainPackageTemplatesBlock('_entityPackage_'),
        templates: ['repository/_entityClass_Repository.java'],
    },
    {
        condition: ctx => ctx.reactive && !ctx.embedded && ctx.entityPersistenceLayer,
        ...javaMainPackageTemplatesBlock('_entityPackage_'),
        templates: ['repository/_entityClass_Repository_reactive.java'],
    },
];
export const entityFiles = {
    domainFiles,
    repositoryFiles,
};
export function cleanupMongodbEntityFilesTask() { }
export default asWritingEntitiesTask(async function writeEntityMongodbFiles({ application, entities }) {
    for (const entity of entities.filter(entity => !entity.skipServer)) {
        await this.writeFiles({
            sections: entityFiles,
            context: { ...application, ...entity },
        });
    }
});
