"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateS3Module = generateS3Module;
const generator_1 = require("@postxl/generator");
function generateS3Module({ config, service, module }) {
    const imports = generator_1.ImportGenerator
        //
        .from(module.location)
        .add(service)
        .add(config)
        .addType(config.type);
    return /* ts */ `
import { DynamicModule } from '@nestjs/common'
${imports.generate()}

export class ${module.name} {
  static forRoot(config: ${config.type.name}): DynamicModule {
    return {
      module: ${module.name},
      providers: [
        ${service.name}, 
        {
          provide: ${config.name},
          useFactory: () => new ${config.name}(config),
        },
      ],
      exports: [${service.name}],
      global: true,
    }
  }
}`;
}
//# sourceMappingURL=s3.module.generator.js.map