import "../types/index.js";
import { CredentialStoreRegistry } from "../credential-stores/CredentialStoreRegistry.js";
import { PinoLogger } from "../utils/logger.js";
import { McpServerConfig } from "../utils/mcp-client.js";
import { MCPToolConfig } from "../types/entities.js";

//#region src/credential-stuffer/CredentialStuffer.d.ts
/**
 * Context object for credential operations
 */
interface CredentialContext {
  /** Tenant identifier */
  tenantId: string;
  /** Project identifier */
  projectId: string;
  /** Conversation identifier */
  conversationId?: string;
  /** Context configuration identifier */
  contextConfigId?: string;
  /** Additional context data */
  metadata?: Record<string, unknown>;
}
/**
 * Base credential data structure containing headers and metadata
 */
interface CredentialData {
  /** HTTP headers for authentication */
  headers: Record<string, string>;
  /** Additional metadata for the credentials */
  metadata?: Record<string, any>;
  expiresAt?: Date;
}
/**
 * Credential store reference for lookups
 */
interface CredentialStoreReference {
  /** Framework credential store ID */
  credentialStoreId: string;
  /** Configuration parameters for credential retrieval */
  retrievalParams: Record<string, unknown>;
}
interface CredentialResolverInput {
  context: CredentialContext;
  mcpType?: MCPToolConfig['mcpType'];
  storeReference?: CredentialStoreReference;
  headers?: Record<string, string>;
}
/**
 * Interface for context resolver (optional)
 */
interface ContextResolverInterface {
  resolveHeaders(conversationId: string, contextConfigId: string): Promise<Record<string, unknown>>;
}
/**
 * Manages credential retrieval and injection for MCP tools
 * Uses CredentialStoreRegistry for credential store management
 */
declare class CredentialStuffer {
  private credentialStoreRegistry;
  private contextResolver?;
  private readonly logger;
  constructor(credentialStoreRegistry: CredentialStoreRegistry, contextResolver?: ContextResolverInterface | undefined, logger?: PinoLogger);
  /**
   * Retrieve credentials from credential store registry
   */
  getCredentials(context: CredentialContext, storeReference: CredentialStoreReference, mcpType?: MCPToolConfig['mcpType']): Promise<CredentialData | null>;
  /**
   * Generate credential lookup key based on store type
   */
  private generateCredentialKey;
  /**
   * Get credentials from headers context
   */
  getCredentialsFromHeaders(credentialContext: CredentialContext, headers: Record<string, string>): Promise<CredentialData | null>;
  /**
   * Get credential headers for MCP server configuration
   */
  getCredentialHeaders({
    context,
    mcpType,
    storeReference,
    headers
  }: CredentialResolverInput): Promise<Record<string, string>>;
  /**
   * Build MCP server configuration with credentials
   */
  buildMcpServerConfig(context: CredentialContext, tool: MCPToolConfig, storeReference?: CredentialStoreReference, selectedTools?: string[]): Promise<McpServerConfig>;
}
//#endregion
export { ContextResolverInterface, CredentialContext, CredentialData, CredentialResolverInput, CredentialStoreReference, CredentialStuffer };