import { ConfigManager, type ConfigManagerOptions } from './config-manager';

// Export only what's actually used
export { ConfigManager } from './config-manager';
export type { ConfigManagerOptions } from './config-manager';
export { toUnifiedConfig } from './schemas/unified-app.schema';

// Export used types
export type { BaseAppConfig, UnifiedAppConfig } from './schemas';

// Export schemas that are used by apps
export {
  baseAppSchema,
  dragonflyConfigSchema,
  mongodbConfigSchema,
  postgresConfigSchema,
  questdbConfigSchema,
  providerConfigSchema,
  providerSchemas,
  eodProviderConfigSchema,
  ibProviderConfigSchema,
  qmProviderConfigSchema,
  yahooProviderConfigSchema,
  type ProviderName,
} from './schemas';

// createAppConfig function for apps/stock
export function createAppConfig<T>(
  schema: unknown,
  options?: ConfigManagerOptions
): ConfigManager<T> {
  return new ConfigManager<T>(options);
}

// Export utilities
export {
  SecretValue,
  secret,
  isSecret,
  isSecretEnvVar,
  COMMON_SECRET_PATTERNS,
  redactSecrets,
  wrapSecretEnvVars,
  secretSchema,
  secretStringSchema
} from './utils/secrets';

export {
  checkRequiredEnvVars,
  createStrictSchema,
  formatValidationResult,
  mergeSchemas,
  validateConfig,
  validateCompleteness,
  type ValidationResult
} from './utils/validation';
