// SPDX-License-Identifier: Apache-2.0

import {type NamespaceName} from '../../../../types/namespace/namespace-name.js';
import {type SecretType} from './secret-type.js';
import {type Secret} from './secret.js';

export interface Secrets {
  /**
   * creates a new Kubernetes secret with the provided attributes
   * @param namespace - the namespace to store the secret
   * @param name - the name of the new secret
   * @param secretType - the secret type
   * @param data - the secret, any values of a key:value pair must be base64 encoded
   * @param labels - the label to use for future label selector queries
   * @returns whether the secret was created successfully
   */
  create(
    namespace: NamespaceName,
    name: string,
    secretType: SecretType,
    data: Record<string, string>,
    labels?: Record<string, string>,
  ): Promise<boolean>;

  createOrReplace(
    namespace: NamespaceName,
    name: string,
    secretType: SecretType,
    data: Record<string, string>,
    labels?: Record<string, string>,
  ): Promise<boolean>;

  replace(
    namespace: NamespaceName,
    name: string,
    secretType: SecretType,
    data: Record<string, string>,
    labels?: Record<string, string>,
  ): Promise<boolean>;

  read(namespace: NamespaceName, name: string): Promise<Secret>;

  /**
   * Delete a secret from the namespace
   * @param namespace - the namespace to store the secret
   * @param name - the name of the existing secret
   * @returns whether the secret was deleted successfully
   */
  delete(namespace: NamespaceName, name: string): Promise<boolean>;

  /**
   * Get secrets by labels
   * @param namespace - the namespace of the secret
   * @param labels - list of labels
   * @returns the list of secrets that match the labels
   */
  list(namespace: NamespaceName, labels?: string[]): Promise<Array<Secret>>;

  exists(namespace: NamespaceName, name: string): Promise<boolean>;
}
