import { Constructor } from "../utils/mixins.js";
import { CacheModule } from "../modules/cache/CacheModule.js";
import { DcqlModule } from "../modules/dcql/DcqlModule.js";
import { DidsModule } from "../modules/dids/DidsModule.js";
import { DifPresentationExchangeModule } from "../modules/dif-presentation-exchange/DifPresentationExchangeModule.js";
import { X509Module } from "../modules/x509/X509Module.js";
import { SdJwtVcModule } from "../modules/sd-jwt-vc/SdJwtVcModule.js";
import { W3cCredentialsModule } from "../modules/vc/W3cCredentialsModule.js";
import { MdocModule } from "../modules/mdoc/MdocModule.js";
import { GenericRecordsModule } from "../modules/generic-records/GenericRecordsModule.js";
import { Module } from "../plugins/Module.js";
import { KeyManagementModule } from "../modules/kms/KeyManagementModule.js";

//#region src/agent/AgentModules.d.ts

/**
 * Simple utility type that represent a map of modules. This is used to map from moduleKey (api key) to the api in the framework.
 */
type ModulesMap = {
  [key: string]: Module;
};
type EmptyModuleMap = {};
/**
 * Default modules can be optionally defined to provide custom configuration. This type makes it so that it is not
 * possible to use a different key for the default modules
 */
type AgentModulesInput = ModulesMap;
/**
 * Type that represents the default agent modules. This is the {@link ModulesMap} variant for the default modules in the framework.
 * It uses the return type of the {@link getDefaultAgentModules} method to automatically infer which modules are always available on
 * the agent and in the agent. namespace.
 */
type DefaultAgentModules = { [moduleKey in keyof ReturnType<typeof getDefaultAgentModules>]: ReturnType<ReturnType<typeof getDefaultAgentModules>[moduleKey]> };
type WithoutDefaultModules<Modules extends ModulesMap> = { [moduleKey in Exclude<keyof Modules, keyof DefaultAgentModules>]: Modules[moduleKey] };
type ModuleApiInstance<M extends Module> = M['api'] extends Constructor<unknown> ? InstanceType<M['api']> : undefined;
/**
 * Type that represents the api object of the agent (`agent.xxx`). It will extract all keys of the modules and map this to the
 * registered {@link Module.api} class instance. If the module does not have an api class registered, the property will be removed
 * and won't be available on the api object.
 *
 * @example
 * If the following AgentModules type was passed:
 * ```ts
 * {
 *   connections: DidCommConnectionsModule
 *   indy: IndyModule
 * }
 * ```
 *
 * And we use the `AgentApi` type like this:
 * ```ts
 * type MyAgentApi = AgentApi<{
 *   connections: DidCommConnectionsModule
 *   indy: IndyModule
 * }>
 * ```
 *
 * the resulting agent api will look like:
 *
 * ```ts
 * {
 *   connections: ConnectionsApi
 * }
 * ```
 *
 * The `indy` module has been ignored because it doesn't define an api class.
 */
type AgentApi<Modules extends ModulesMap> = { [moduleKey in keyof Modules as Modules[moduleKey]['api'] extends Constructor<unknown> ? moduleKey : never]: ModuleApiInstance<Modules[moduleKey]> };
/**
 * Method to get the default agent modules to be registered on any agent instance. It doens't configure the modules in any way,
 * and if that's needed the user needs to provide the module in the agent constructor
 */
declare function getDefaultAgentModules(): {
  readonly dcql: () => DcqlModule;
  readonly genericRecords: () => GenericRecordsModule;
  readonly dids: () => DidsModule;
  readonly w3cCredentials: () => W3cCredentialsModule;
  readonly cache: () => CacheModule;
  readonly pex: () => DifPresentationExchangeModule;
  readonly sdJwtVc: () => SdJwtVcModule;
  readonly x509: () => X509Module;
  readonly mdoc: () => MdocModule;
  readonly kms: () => KeyManagementModule;
};
/**
 * Extend the provided modules object with the default agent modules. If the modules property already contains a module with the same
 * name as a default module, the module won't be added to the extended module object. This allows users of the framework to override
 * the modules with custom configuration. The agent constructor type ensures you can't provide a different module for a key that registered
 * on the default agent.
 */
//#endregion
export { AgentApi, AgentModulesInput, DefaultAgentModules, EmptyModuleMap, ModuleApiInstance, ModulesMap, WithoutDefaultModules };
//# sourceMappingURL=AgentModules.d.ts.map