import { B2CInstance } from '../../instance/index.js';
import type { JobExecution, WaitForJobOptions } from '../jobs/run.js';
import type { CommerceAppManifest } from './validate.js';
/**
 * A commerce feature state parsed from the commerce-feature-states.xml export.
 */
export interface CommerceFeatureState {
    siteId: string;
    featureName: string;
    featureType: string;
    featureSource: string;
    featureDomain: string;
    installStatus: string;
    configStatus: string;
    featureVersionId: string;
    installedAt: string;
    configTasks?: unknown[];
    installationMetadata?: unknown;
}
/**
 * A locally discovered Commerce App Package.
 */
export interface LocalCommerceApp {
    /** Absolute path to the directory containing commerce-app.json. */
    path: string;
    /** Parsed manifest from commerce-app.json. */
    manifest: CommerceAppManifest;
}
/**
 * Options for listing installed apps on an instance.
 */
export interface ListInstalledAppsOptions {
    /** Specific site IDs to query. If omitted, discovers all sites via OCAPI. */
    sites?: string[];
    /** Wait options for the export job. */
    waitOptions?: WaitForJobOptions;
}
/**
 * Result of listing installed apps on an instance.
 */
export interface ListInstalledAppsResult {
    /** Parsed commerce feature states from all queried sites. */
    features: CommerceFeatureState[];
    /** Job execution details. */
    execution: JobExecution;
}
/**
 * Discovers local Commerce App Packages by searching for commerce-app.json files.
 *
 * Walks the directory tree starting from `searchPath`, finds directories
 * containing a `commerce-app.json` file, and reads each manifest.
 *
 * @param searchPath - Root directory to search
 * @returns Array of discovered local apps with their paths and manifests
 *
 * @example
 * ```typescript
 * const apps = await discoverLocalApps('./my-workspace');
 * for (const app of apps) {
 *   console.log(`${app.manifest.id}@${app.manifest.version} at ${app.path}`);
 * }
 * ```
 */
export declare function discoverLocalApps(searchPath: string): Promise<LocalCommerceApp[]>;
/**
 * Lists installed Commerce Apps on a B2C instance by exporting commerce feature states.
 *
 * Attempts to export the `commerce_feature_states` data unit for each site.
 * If the export fails (e.g. because the data unit is not yet supported on the server),
 * falls back to a bundled stub fixture.
 *
 * @param instance - B2C instance to query
 * @param options - Options including optional site filter and wait options
 * @returns List of commerce feature states across all queried sites
 *
 * @example
 * ```typescript
 * const result = await listInstalledApps(instance);
 * for (const state of result.features) {
 *   console.log(`${state.featureName} (${state.installStatus}) on ${state.siteId}`);
 * }
 * ```
 */
export declare function listInstalledApps(instance: B2CInstance, options?: ListInstalledAppsOptions): Promise<ListInstalledAppsResult>;
/**
 * Parses a commerce-feature-states.xml string into CommerceFeatureState objects.
 *
 * @param xml - XML string to parse
 * @param siteId - Site ID to associate with parsed states (used as fallback if not in XML attributes)
 * @returns Array of parsed commerce feature states
 */
export declare function parseCommerceFeatureStatesXml(xml: string, siteId: string): Promise<CommerceFeatureState[]>;
