"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.ProviderCoreModule = void 0;
const common_1 = require("@nestjs/common");
const config_1 = require("@nestjs/config");
const common_module_1 = require("../common/common.module");
const certificate_provider_factory_1 = require("./core/factories/certificate-provider.factory");
const tokens_1 = require("./core/tokens");
const certificate_provider_enum_1 = require("./enums/certificate-provider.enum");
const node_size_mapper_1 = require("./mappers/node-size.mapper");
const pricing_mapper_1 = require("./mappers/pricing.mapper");
const acme_certificate_service_1 = require("./services/acme-certificate.service");
/**
 * Shared provider core module — contains only components with no storage dependencies.
 * Used by both ProvidersModule (API) and CliProvidersModule (CLI).
 *
 * @Global() makes NodeSizeMapper, PricingMapper, LabelService (via CommonModule),
 * CacheService, and ConfigService available to all provider implementation modules
 * (HetznerProviderModule, ContaboProviderModule, etc.) without explicit imports.
 *
 * Does NOT include cloud provider services (Hetzner, Contabo) because they depend
 * on ICredentialProvider which differs between API (DB) and CLI (file).
 */
let ProviderCoreModule = class ProviderCoreModule {
};
exports.ProviderCoreModule = ProviderCoreModule;
exports.ProviderCoreModule = ProviderCoreModule = __decorate([
    (0, common_1.Global)(),
    (0, common_1.Module)({
        imports: [config_1.ConfigModule, common_module_1.CommonModule],
        providers: [
            node_size_mapper_1.NodeSizeMapper,
            pricing_mapper_1.PricingMapper,
            acme_certificate_service_1.AcmeCertificateService,
            {
                provide: tokens_1.CERTIFICATE_PROVIDER_REGISTRY,
                useFactory: (service) => [
                    { provider: certificate_provider_enum_1.CertificateProvider.LETS_ENCRYPT, service },
                    { provider: certificate_provider_enum_1.CertificateProvider.LETS_ENCRYPT_STAGING, service },
                ],
                inject: [acme_certificate_service_1.AcmeCertificateService],
            },
            certificate_provider_factory_1.CertificateProviderFactory,
        ],
        exports: [
            common_module_1.CommonModule,
            node_size_mapper_1.NodeSizeMapper,
            pricing_mapper_1.PricingMapper,
            acme_certificate_service_1.AcmeCertificateService,
            certificate_provider_factory_1.CertificateProviderFactory,
        ],
    })
], ProviderCoreModule);
