import { typescriptFileProvider } from '@baseplate-dev/core-generators';
import { errorHandlerServiceImportsProvider, pothosImportsProvider, prismaUtilsImportsProvider, serviceContextImportsProvider, } from '@baseplate-dev/fastify-generators';
import { createGeneratorTask, createProviderType } from '@baseplate-dev/sync';
import { FASTIFY_STORAGE_MODULE_PATHS } from './template-paths.js';
import { FASTIFY_STORAGE_MODULE_TEMPLATES } from './typed-templates.js';
const fastifyStorageModuleRenderers = createProviderType('fastify-storage-module-renderers');
const fastifyStorageModuleRenderersTask = createGeneratorTask({
    dependencies: {
        errorHandlerServiceImports: errorHandlerServiceImportsProvider,
        paths: FASTIFY_STORAGE_MODULE_PATHS.provider,
        pothosImports: pothosImportsProvider,
        prismaUtilsImports: prismaUtilsImportsProvider,
        serviceContextImports: serviceContextImportsProvider,
        typescriptFile: typescriptFileProvider,
    },
    exports: {
        fastifyStorageModuleRenderers: fastifyStorageModuleRenderers.export(),
    },
    run({ errorHandlerServiceImports, paths, pothosImports, prismaUtilsImports, serviceContextImports, typescriptFile, }) {
        return {
            providers: {
                fastifyStorageModuleRenderers: {
                    configAdapters: {
                        render: (options) => typescriptFile.renderTemplateFile({
                            template: FASTIFY_STORAGE_MODULE_TEMPLATES.configAdapters,
                            destination: paths.configAdapters,
                            ...options,
                        }),
                    },
                    configCategories: {
                        render: (options) => typescriptFile.renderTemplateFile({
                            template: FASTIFY_STORAGE_MODULE_TEMPLATES.configCategories,
                            destination: paths.configCategories,
                            generatorPaths: paths,
                            ...options,
                        }),
                    },
                    mainGroup: {
                        render: (options) => typescriptFile.renderTemplateGroup({
                            group: FASTIFY_STORAGE_MODULE_TEMPLATES.mainGroup,
                            paths,
                            importMapProviders: {
                                errorHandlerServiceImports,
                                prismaUtilsImports,
                                serviceContextImports,
                            },
                            generatorPaths: paths,
                            ...options,
                        }),
                    },
                    schemaGroup: {
                        render: (options) => typescriptFile.renderTemplateGroup({
                            group: FASTIFY_STORAGE_MODULE_TEMPLATES.schemaGroup,
                            paths,
                            importMapProviders: {
                                pothosImports,
                            },
                            generatorPaths: paths,
                            ...options,
                        }),
                    },
                },
            },
        };
    },
});
export const FASTIFY_STORAGE_MODULE_RENDERERS = {
    provider: fastifyStorageModuleRenderers,
    task: fastifyStorageModuleRenderersTask,
};
//# sourceMappingURL=template-renderers.js.map