/**
 * CLI configuration utilities.
 *
 * This module provides configuration loading for CLI commands.
 * It uses {@link resolveConfig} internally for consistent behavior.
 *
 * @module cli/config
 */
import type { AuthMethod } from '../auth/types.js';
import { ALL_AUTH_METHODS } from '../auth/types.js';
import { type NormalizedConfig, type ConfigSource, type ResolvedB2CConfig } from '../config/index.js';
import { findDwJson } from '../config/dw-json.js';
export type { AuthMethod };
export { ALL_AUTH_METHODS };
export { findDwJson };
/**
 * Type for oclif parsed flags object.
 * Using Record<string, unknown> since flags can have various types.
 */
export type ParsedFlags = Record<string, unknown>;
/**
 * Extracts OAuth-related configuration from oclif flags.
 *
 * Use this to extract OAuth flags (--client-id, --client-secret, etc.)
 * from parsed oclif flags into a NormalizedConfig partial.
 *
 * @param flags - Parsed oclif flags
 * @returns Partial NormalizedConfig with OAuth fields
 *
 * @example
 * ```typescript
 * const flagConfig = extractOAuthFlags(this.flags);
 * return loadConfig(flagConfig, options);
 * ```
 */
export declare function extractOAuthFlags(flags: ParsedFlags): Partial<NormalizedConfig>;
/**
 * Extracts ODS-related configuration from oclif flags.
 *
 * Includes OAuth flags since ODS operations require OAuth authentication.
 *
 * @param flags - Parsed oclif flags
 * @returns Partial NormalizedConfig with ODS and OAuth fields
 */
export declare function extractOdsFlags(flags: ParsedFlags): Partial<NormalizedConfig>;
/**
 * Extracts B2C instance-related configuration from oclif flags.
 *
 * Includes both instance-specific flags (--server, --username, etc.)
 * and OAuth flags since instance operations often need both.
 *
 * @param flags - Parsed oclif flags
 * @returns Partial NormalizedConfig with instance and OAuth fields
 *
 * @example
 * ```typescript
 * const flagConfig = extractInstanceFlags(this.flags);
 * return loadConfig(flagConfig, options);
 * ```
 */
export declare function extractInstanceFlags(flags: ParsedFlags): Partial<NormalizedConfig>;
/**
 * Result of extracting MRT flags from oclif parsed flags.
 *
 * Contains both config values (for loadConfig's first argument) and
 * loading options (to spread into LoadConfigOptions).
 */
export interface ExtractedMrtFlags {
    /** MRT config values to pass to loadConfig's first argument */
    config: Partial<NormalizedConfig>;
    /** MRT loading options to spread into LoadConfigOptions */
    options: Pick<LoadConfigOptions, 'cloudOrigin' | 'credentialsFile'>;
}
/**
 * Extracts MRT (Managed Runtime) configuration from oclif flags.
 *
 * Use this to extract MRT flags (--api-key, --project, --environment, --cloud-origin, --credentials-file)
 * from parsed oclif flags. Returns both config values and loading options.
 *
 * @param flags - Parsed oclif flags
 * @returns Object with `config` (NormalizedConfig partial) and `options` (LoadConfigOptions partial)
 *
 * @example
 * ```typescript
 * const mrt = extractMrtFlags(this.flags);
 * const options: LoadConfigOptions = {
 *   ...this.getBaseConfigOptions(),
 *   ...mrt.options,
 * };
 * return loadConfig(mrt.config, options);
 * ```
 */
export declare function extractMrtFlags(flags: ParsedFlags): ExtractedMrtFlags;
/**
 * Options for loading configuration.
 */
export interface LoadConfigOptions {
    /** Named instance from dw.json "configs" array */
    instance?: string;
    /** Explicit path to config file (skips searching if provided) */
    configPath?: string;
    /** Starting directory for config file search (default: current project directory) */
    projectDirectory?: string;
    /** @deprecated Use projectDirectory instead */
    workingDirectory?: string;
    /** Cloud origin for MRT ~/.mobify lookup (e.g., https://cloud-staging.mobify.com) */
    cloudOrigin?: string;
    /** Path to custom MRT credentials file (overrides default ~/.mobify) */
    credentialsFile?: string;
    /** Account Manager hostname for OAuth (passed to plugins for host-specific config) */
    accountManagerHost?: string;
}
/**
 * Plugin-provided configuration sources with priority ordering.
 *
 * @deprecated Plugin config sources are now registered with the global
 * {@link globalConfigSourceRegistry} and automatically included in
 * {@link resolveConfig}. This type is retained for backwards compatibility.
 */
export interface PluginSources {
    /**
     * Sources with high priority (inserted BEFORE dw.json/~/.mobify).
     * These sources can override values from default configuration files.
     */
    before?: ConfigSource[];
    /**
     * Sources with low priority (inserted AFTER dw.json/~/.mobify).
     * These sources fill in gaps left by default configuration files.
     */
    after?: ConfigSource[];
}
/**
 * Loads configuration with precedence: CLI flags/env vars > dw.json > ~/.mobify
 *
 * OCLIF handles environment variables automatically via flag `env` properties.
 * The flags parameter already contains resolved env var values.
 *
 * Uses {@link resolveConfig} internally for consistent behavior across CLI and SDK.
 *
 * @param flags - Configuration values from CLI flags/env vars
 * @param options - Loading options
 * @param pluginSources - @deprecated Plugin sources are now registered globally via
 *   {@link globalConfigSourceRegistry}. This parameter is retained for backwards compatibility.
 * @returns Resolved configuration with factory methods
 *
 * @example
 * ```typescript
 * // In a CLI command
 * const config = loadConfig(
 *   { hostname: this.flags.server, clientId: this.flags['client-id'] },
 *   { instance: this.flags.instance }
 * );
 *
 * if (config.hasB2CInstanceConfig()) {
 *   const instance = config.createB2CInstance();
 * }
 * ```
 */
export declare function loadConfig(flags?: Partial<NormalizedConfig>, options?: LoadConfigOptions, pluginSources?: PluginSources): ResolvedB2CConfig;
