import { extname } from 'path';
import { passthrough } from '@yeoman/transform';
import { isFileStateDeleted } from 'mem-fs-editor/state';
import addJavaAnnotation from './add-java-annotation.mjs';
const generatedAnnotationTransform = packageName => {
    return passthrough(file => {
        if (!file.path.endsWith('package-info.java') &&
            extname(file.path) === '.java' &&
            !isFileStateDeleted(file) &&
            !file.path.endsWith('GeneratedByJHipster.java')) {
            file.contents = Buffer.from(addJavaAnnotation(file.contents.toString('utf8'), { package: packageName, annotation: 'GeneratedByBegcode' }));
        }
    });
};
export default generatedAnnotationTransform;
