import { DecoratorDriver } from '../../engine/code-writer/drivers/decorator.driver.js';
import { ImportDriver } from '../../engine/code-writer/drivers/import.driver.js';
import { addScheduleModule, addToSharedModule, changeSharedModuleAdapter, declareBackPackageModule, runGraphqlTypes, } from '../package-helpers.js';
export default async function install(ctx) {
    await ctx.install(['@nestjs/axios', '@nestjs/schedule']);
    await ctx.install(['@types/cron'], { dev: true });
    declareBackPackageModule(ctx, 'AuditingModule', '@app/modules/auditing/auditing.module');
    addScheduleModule(ctx);
    const sharedModule = ctx.sourceFile('app', 'shared.module.ts');
    ImportDriver.createImportItems(sharedModule, '@nestjs/axios', ['HttpModule']);
    addToSharedModule(sharedModule, 'imports', 'HttpModule');
    addToSharedModule(sharedModule, 'exports', 'HttpModule');
    ImportDriver.createImportItems(sharedModule, '@app/modules/auditing/interceptors/auditing-axios-interceptor.service', ['AuditingAxiosInterceptorService']);
    DecoratorDriver.addModuleDecoratorProperty(sharedModule, 'SharedModule', 'Module', 'providers', 'AuditingAxiosInterceptorService');
    changeSharedModuleAdapter(sharedModule, 'providers', 'AuditingRunner', 'AuditingAxiosRunner', '@app/modules/auditing/runners/auditing-axios.runner', ['AuditingAxiosRunner']);
    sharedModule.saveSync();
    await runGraphqlTypes(ctx);
}
