import { LOCAL_BLUEPRINT_OPTION } from './constants.js';
export const files = {
    baseFiles: [
        {
            condition: ctx => !ctx[LOCAL_BLUEPRINT_OPTION],
            templates: [
                '.github/workflows/generator.yml',
                '.prettierignore.jhi.blueprint',
                'eslint.config.js',
                'README.md',
                'tsconfig.json',
                'vitest.config.ts',
                'vitest.test-setup.ts',
                '.blueprint/cli/commands.mjs',
                '.blueprint/generate-sample/command.mjs',
                '.blueprint/generate-sample/generator.mjs',
                '.blueprint/generate-sample/index.mjs',
            ],
        },
        {
            condition: ctx => !ctx[LOCAL_BLUEPRINT_OPTION] && ctx.githubWorkflows,
            templates: [
                '.blueprint/github-build-matrix/build-matrix.mjs',
                '.blueprint/github-build-matrix/generator.mjs',
                '.blueprint/github-build-matrix/index.mjs',
                '.github/workflows/build-cache.yml',
                '.github/workflows/samples.yml',
            ],
        },
        {
            condition: ctx => !ctx[LOCAL_BLUEPRINT_OPTION] && !ctx.sampleWritten,
            templates: ['.blueprint/generate-sample/templates/samples/sample.jdl'],
        },
        {
            condition: ctx => ctx.cli,
            templates: ['cli/cli.cjs'],
        },
        {
            condition: ctx => ctx.commands.length > 0,
            templates: ['cli/commands.cjs'],
        },
    ],
};
export const generatorFiles = {
    generator: [
        {
            path: 'generators/generator',
            to: ctx => `${ctx.application.blueprintsPath}${ctx.generator}`,
            templates: [
                { file: 'generator.mjs.jhi', renameTo: ctx => (ctx.js ? 'generator.js.jhi' : 'generator.mjs.jhi') },
                { file: 'index.mjs', renameTo: ctx => (ctx.js ? 'index.js' : 'index.mjs') },
            ],
        },
        {
            path: 'generators/generator',
            condition: ctx => ctx.priorities.find(priority => priority.name === 'initializing'),
            to: ctx => `${ctx.application.blueprintsPath}${ctx.generator}`,
            templates: [{ file: 'command.mjs', renameTo: ctx => (ctx.js ? 'command.js' : 'command.mjs') }],
        },
        {
            path: 'generators/generator',
            to: ctx => `${ctx.application.blueprintsPath}${ctx.generator}`,
            condition: ctx => !ctx.generator.startsWith('entity') && !ctx.application[LOCAL_BLUEPRINT_OPTION],
            templates: [
                {
                    file: 'generator.spec.mjs',
                    renameTo: ctx => (ctx.js ? 'generator.spec.js' : 'generator.spec.mjs'),
                },
            ],
        },
        {
            path: 'generators/generator',
            to: ctx => `${ctx.application.blueprintsPath}${ctx.generator}`,
            condition(ctx) {
                return (this.options.force || !ctx.written) && ctx.priorities.find(priority => priority.name === 'writing');
            },
            transform: false,
            templates: [
                {
                    file: 'templates/template-file.ejs',
                    renameTo: ctx => `templates/template-file-${ctx.generator}.ejs`,
                },
            ],
        },
    ],
};
