"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccessModule = void 0;
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const config_1 = require("@nestjs/config");
const access_controller_1 = require("./access.controller");
const access_service_1 = require("./services/access.service");
const ssh_key_generator_service_1 = require("./services/ssh-key-generator.service");
const default_access_repository_1 = require("./repositories/default-access.repository");
const ssh_key_entity_1 = require("./entities/ssh-key.entity");
const key_storage_service_1 = require("./services/key-storage.service");
const bearerToken_service_1 = require("./services/bearerToken.service");
const axios_1 = require("@nestjs/axios");
const provider_credentials_repository_1 = require("./repositories/provider-credentials.repository");
const credentials_entity_1 = require("./entities/credentials.entity");
const jwt_1 = require("@nestjs/jwt");
const api_token_repository_1 = require("./repositories/api-token.repository");
const api_token_entity_1 = require("./entities/api-token.entity");
const ssh_provider_factory_1 = require("./providers/ssh-provider.factory");
const contabo_ssh_provider_service_1 = require("./providers/contabo-ssh-provider.service");
const hetzner_ssh_provider_service_1 = require("./providers/hetzner-ssh-provider.service");
const providers_1 = require("../providers");
const common_module_1 = require("../common/common.module");
const ca_keypair_entity_1 = require("./entities/ca-keypair.entity");
const ca_manager_service_1 = require("./services/ca-manager.service");
const certificate_signer_service_1 = require("./services/certificate-signer.service");
const ca_controller_1 = require("./controllers/ca.controller");
const cluster_entity_1 = require("../infrastructure/clusters/entities/cluster.entity");
const accessRepositoryProvider = {
    provide: 'IAccessRepository',
    useClass: default_access_repository_1.DefaultAccessRepository,
};
const providerCredentialsRepositoryProvider = {
    provide: 'IProviderCredentialsRepository',
    useClass: provider_credentials_repository_1.ProviderCredentialsRepository,
};
const apiTokenRepositoryProvider = {
    provide: 'IApiTokenRepository',
    useClass: api_token_repository_1.ApiTokenRepository,
};
let AccessModule = class AccessModule {
};
exports.AccessModule = AccessModule;
exports.AccessModule = AccessModule = __decorate([
    (0, common_1.Module)({
        imports: [
            config_1.ConfigModule,
            axios_1.HttpModule,
            (0, common_1.forwardRef)(() => providers_1.ProvidersModule),
            common_module_1.CommonModule,
            typeorm_1.TypeOrmModule.forFeature([
                ssh_key_entity_1.SSHKeyEntity,
                credentials_entity_1.ProviderCredentialsEntity,
                api_token_entity_1.ApiTokenEntity,
                ca_keypair_entity_1.CAKeypairEntity,
                cluster_entity_1.ClusterEntity,
            ]),
        ],
        controllers: [access_controller_1.AccessController, ca_controller_1.CAController],
        providers: [
            access_service_1.AccessService,
            ssh_key_generator_service_1.SSHKeyGeneratorService,
            accessRepositoryProvider,
            providerCredentialsRepositoryProvider,
            apiTokenRepositoryProvider,
            key_storage_service_1.KeyStorageService,
            bearerToken_service_1.BearerTokenService,
            provider_credentials_repository_1.ProviderCredentialsRepository,
            api_token_repository_1.ApiTokenRepository,
            jwt_1.JwtService,
            ssh_provider_factory_1.SSHProviderFactory,
            hetzner_ssh_provider_service_1.HetznerSSHProviderService,
            contabo_ssh_provider_service_1.ContaboSSHProviderService,
            ca_manager_service_1.CAManagerService,
            certificate_signer_service_1.CertificateSignerService,
        ],
        exports: [
            access_service_1.AccessService,
            ca_manager_service_1.CAManagerService,
            certificate_signer_service_1.CertificateSignerService,
            ssh_key_generator_service_1.SSHKeyGeneratorService,
            key_storage_service_1.KeyStorageService,
        ],
    })
], AccessModule);
