// SPDX-License-Identifier: Apache-2.0
import { UpgradeChartOptionsBuilder } from '../../model/upgrade/upgrade-chart-options-builder.js';
/**
 * A request to upgrade a Helm chart.
 */
export class ChartUpgradeRequest {
    releaseName;
    chart;
    options;
    /**
     * Creates a new upgrade request with the given chart and options.
     *
     * @param releaseName The name of the release to upgrade.
     * @param chart The chart to upgrade to.
     * @param options The options to use when upgrading the chart.
     */
    constructor(releaseName, chart, options = UpgradeChartOptionsBuilder.builder().build()) {
        this.releaseName = releaseName;
        this.chart = chart;
        this.options = options;
        if (!releaseName) {
            throw new Error('releaseName must not be null');
        }
        if (releaseName.trim() === '') {
            throw new Error('releaseName must not be blank');
        }
        if (!chart) {
            throw new Error('chart must not be null');
        }
        if (!options) {
            throw new Error('options must not be null');
        }
    }
    /**
     * Applies this request to the given builder.
     * @param builder The builder to apply the request to.
     */
    apply(builder) {
        builder.subcommands('upgrade');
        this.options.apply(builder);
        builder.positional(this.releaseName).positional(this.chart.qualified());
    }
}
//# sourceMappingURL=chart-upgrade-request.js.map