// SPDX-License-Identifier: Apache-2.0
import { instanceToPlain, plainToInstance } from 'class-transformer';
import { SoloConfigSchema } from '../../../../data/schema/model/solo/solo-config-schema.js';
import { HelmChart } from '../common/helm-chart.js';
import { Tss } from './tss.js';
export class SoloConfig {
    encapsulatedObject;
    _helmChart;
    _ingressControllerHelmChart;
    _clusterSetupHelmChart;
    _certManagerHelmChart;
    _tss;
    constructor(schema) {
        // Deep copy for immutability — prevents callers from mutating projected config through the schema ref
        this.encapsulatedObject = plainToInstance(SoloConfigSchema, instanceToPlain(schema ?? new SoloConfigSchema()));
        this._helmChart = new HelmChart(this.encapsulatedObject.helmChart);
        this._ingressControllerHelmChart = new HelmChart(this.encapsulatedObject.ingressControllerHelmChart);
        this._clusterSetupHelmChart = new HelmChart(this.encapsulatedObject.clusterSetupHelmChart);
        this._certManagerHelmChart = new HelmChart(this.encapsulatedObject.certManagerHelmChart);
        this._tss = new Tss(this.encapsulatedObject.tss);
    }
    static getConfig(configProvider) {
        return new SoloConfig(configProvider.config().asObject(SoloConfigSchema));
    }
    get helmChart() {
        return this._helmChart;
    }
    get ingressControllerHelmChart() {
        return this._ingressControllerHelmChart;
    }
    get clusterSetupHelmChart() {
        return this._clusterSetupHelmChart;
    }
    get certManagerHelmChart() {
        return this._certManagerHelmChart;
    }
    get tss() {
        return this._tss;
    }
}
//# sourceMappingURL=solo-config.js.map