import { CredentialStore } from "../types/server.js";

//#region src/credential-stores/memory-store.d.ts

/**
 * In-memory credential store implementation
 * Automatically loads environment variables prefixed with CREDENTIAL_STORE_ on initialization
 * Note: Runtime credentials are lost when the server restarts, but env vars are reloaded
 */
declare class InMemoryCredentialStore implements CredentialStore {
  readonly id: string;
  readonly type: "memory";
  private credentials;
  constructor(id?: string);
  /**
   * Get a credential from the in memory store.
   * If the key is not found in the in memory store then it is loaded from environment variables.
   * If the key is not found in the environment variables or in the in memory store then returns null.
   * @param key - The key of the credential to get
   * @returns The credential value or null if not found
   */
  get(key: string): Promise<string | null>;
  /**
   * Set a credential in the in memory store.
   * @param key - The key of the credential to set
   * @param value - The value of the credential to set
   * @param metadata - Optional metadata (ignored by memory store)
   */
  set(key: string, value: string, _metadata?: Record<string, string>): Promise<void>;
  /**
   * Check if a credential exists in the in memory store.
   * @param key - The key of the credential to check
   * @returns True if the credential exists, false otherwise
   */
  has(key: string): Promise<boolean>;
  /**
   * Delete a credential from the in memory store.
   * @param key - The key of the credential to delete
   * @returns True if the credential was deleted, false otherwise
   */
  delete(key: string): Promise<boolean>;
  /**
   * Check if the credential store is available and functional
   */
  checkAvailability(): Promise<{
    available: boolean;
    reason?: string;
  }>;
}
//#endregion
export { InMemoryCredentialStore };