// SPDX-License-Identifier: Apache-2.0

import {type HelmExecutionBuilder} from '../../execution/helm-execution-builder.js';
import {type Options} from '../options.js';

/**
 * Options for uninstalling a Helm chart.
 */
export class UnInstallChartOptions implements Options {
  private readonly _namespace?: string;
  private readonly _kubeContext?: string;

  public constructor(namespace?: string, kubeContext?: string) {
    this._namespace = namespace;
    this._kubeContext = kubeContext;
  }

  /**
   * Gets the namespace where the release should be uninstalled.
   * @returns The namespace or undefined if not set.
   */
  public get namespace(): string | undefined {
    return this._namespace;
  }

  /**
   * Gets the Kubernetes context to use.
   * @returns The Kubernetes context or undefined if not set.
   */
  public get kubeContext(): string | undefined {
    return this._kubeContext;
  }

  /**
   * Applies the options to the given builder.
   * @param builder The builder to apply the options to.
   */
  public apply(builder: HelmExecutionBuilder): void {
    if (this._namespace) {
      builder.argument('namespace', this._namespace);
    }
    if (this._kubeContext) {
      builder.argument('kube-context', this._kubeContext);
    }
  }
}
