import type { ISettingsBackend, IEmbeddingsBackend } from './storage.js';
import type { ILogDestination } from './logging.js';
import type { IAddonPageProvider, IAdminUI } from './addon.js';
import type { IAuthProvider } from './auth-provider.js';
import type { IAddonRouteProvider } from './addon-routes.js';
import type { IAdvancedNotifier } from './advanced-notifier.js';
import type { IRestreamer } from './restreamer.js';
import type { IWebRtcProvider } from './webrtc-provider.js';
import type { streamBrokerCapability } from '../capabilities/stream-broker.cap.js';
import type { InferProvider } from '../capabilities/capability-definition.js';
import type { ISnapshotOrchestrator } from '../capabilities/snapshot.cap.js';
import type { INetworkAccessProvider } from './server-network.js';
import type { IStreamingEngine } from './streaming.js';
import type { IPipelineExecutorProvider } from './pipeline-executor-capability.js';
import type { IPipelineOrchestratorProvider } from './pipeline-orchestrator-capability.js';
import type { IPipelineRunnerProvider } from './pipeline-runner-capability.js';
import type { IEmbeddingEncoder } from './embedding-encoder.js';
import type { IDecoderProvider } from './decoder.js';
import type { StepDefinition } from '../types/pipeline-step.js';
import type { SingletonCapabilityName, CollectionCapabilityName } from '../generated/capability-router-map.js';
/**
 * Pipeline step capability — each step is a separate capability
 * named `pipeline-step:{stepId}` (e.g., `pipeline-step:object-detection`).
 *
 * Collection mode: multiple addons can provide the same step ID.
 * The user selects which provider to use per-camera or globally.
 */
export type IPipelineStepProvider = StepDefinition;
/**
 * Cardinality of active providers for a capability:
 *   - `singleton` — one active provider cluster-wide
 *   - `collection` — every registered provider stays active
 *   - `per-node` — one active provider per node/agent
 */
export type CapabilityMode = 'singleton' | 'collection' | 'per-node';
/**
 * Declared in addon package.json manifests under camstack.addons[].capabilities.
 *
 * Mode (singleton / collection) is **not** declared here — the single source
 * of truth is the cap definition in `packages/types/src/capabilities/*.cap.ts`.
 * The kernel looks up the mode at registration time via the pre-declared
 * CapabilityDefinition. Manifests only reference the cap by name and
 * optionally declare dependencies + autoActivate. Session 5 A5 consolidation
 * removed the duplicated `mode` field from every addon manifest — see the
 * audit addendum finding R6 in the session 4 handover.
 */
export interface CapabilityDeclaration {
    /** Capability name (e.g. 'storage', 'decoder', 'pipeline-analytics') */
    readonly name: string;
    /** Optional dependencies — addon won't initialize until these capabilities are available */
    readonly dependsOn?: readonly string[];
    /**
     * Auto-activate this capability on all devices.
     * When true, this addon's capability is active on every device by default.
     * Users can disable it per-device. Default: false.
     */
    readonly autoActivate?: boolean;
    /**
     * When true, the addon may omit calling registerProvider() for this
     * capability during initialize(). Validation will not warn about it.
     * Use for capabilities the addon conditionally provides (e.g. only
     * when a hardware accelerator is present).
     */
    readonly optional?: boolean;
    /**
     * Registration kind for the provider this addon publishes for the cap.
     * Mirrors `ProviderRegistration.kind` — the manifest is the source of
     * truth at BOOT time, before the addon's `onInitialize()` has had a
     * chance to return ProviderRegistration[] (which is critical for
     * forked/isolated addons whose runtime registrations never reach
     * the hub's wrapperProviders set through the Moleculer capability
     * bridge). When omitted, defaults to 'native' (the hub calls
     * `registerProvider` without touching wrapperProviders). When
     * `'wrapper'`, the hub calls `registerWrapper(capName, addonId,
     * {defaultActive})` at manifest-load time so the cap appears in
     * device-manager.getBindings / listBindableCapsForDeviceType even
     * for isolated addons.
     */
    readonly kind?: 'native' | 'wrapper';
    /**
     * Wrapper-only — when true, the wrapper is auto-bound
     * (`defaultActive:true`) for every compatible device. Has no effect
     * when `kind !== 'wrapper'`.
     */
    readonly defaultActive?: boolean;
}
/**
 * Registration object for a service that consumes a capability.
 * The registry calls the appropriate callback when providers are added/removed/replaced.
 */
export interface CapabilityConsumerRegistration<T = unknown> {
    /** Which capability this consumer needs */
    readonly capability: string;
    /** Called when a singleton provider is set or replaced. Async for teardown of previous. */
    onSet?(provider: T): void | Promise<void>;
    /** Called when a collection provider is added */
    onAdded?(provider: T): void | Promise<void>;
    /** Called when a collection provider is removed (addon disabled) */
    onRemoved?(provider: T): void | Promise<void>;
}
/**
 * Introspection data for a registered capability.
 */
export interface CapabilityInfo {
    readonly name: string;
    readonly mode: CapabilityMode;
    /** All addon IDs that provide this capability */
    readonly providers: readonly string[];
    /** For singleton: the active addon ID (null if none) */
    readonly activeProvider: string | null;
    /** For collection: addon IDs that are registered but disabled */
    readonly disabledProviders: readonly string[];
}
/**
 * Maps capability names to their provider interfaces.
 * Extensible via TypeScript declaration merging:
 *
 * ```typescript
 * declare module '@camstack/types' {
 *   interface CapabilityProviderMap {
 *     'my-custom-capability': IMyProvider
 *   }
 * }
 * ```
 */
export interface CapabilityProviderMap {
    'storage': InferProvider<typeof import('../capabilities/storage.cap.js').storageCapability>;
    'log-destination': ILogDestination;
    'restreamer': IRestreamer;
    'webrtc': IWebRtcProvider;
    'stream-broker': InferProvider<typeof streamBrokerCapability>;
    'addon-pages': InferProvider<typeof import('../capabilities/addon-pages.cap.js').addonPagesCapability>;
    'addon-pages-source': IAddonPageProvider;
    'addon-widgets': InferProvider<typeof import('../capabilities/addon-widgets.cap.js').addonWidgetsCapability>;
    'addon-widgets-source': InferProvider<typeof import('../capabilities/addon-widgets-source.cap.js').addonWidgetsSourceCapability>;
    'admin-ui': IAdminUI;
    'auth-provider': IAuthProvider;
    'notification-output': InferProvider<typeof import('../capabilities/notification-output.cap.js').notificationOutputCapability>;
    'addon-routes': IAddonRouteProvider;
    'recording-engine': InferProvider<typeof import('../capabilities/recording-engine.cap.js').recordingEngineCapability>;
    'pipeline-analytics': InferProvider<typeof import('../capabilities/pipeline-analytics.cap.js').pipelineAnalyticsCapability>;
    'device-provider': InferProvider<typeof import('../capabilities/device-provider.cap.js').deviceProviderCapability>;
    'device-manager': InferProvider<typeof import('../capabilities/device-manager.cap.js').deviceManagerCapability>;
    'device-state': InferProvider<typeof import('../capabilities/device-state.cap.js').deviceStateCapability>;
    'user-management': InferProvider<typeof import('../capabilities/user-management.cap.js').userManagementCapability>;
    'platform-probe': InferProvider<typeof import('../capabilities/platform-probe.cap.js').platformProbeCapability>;
    'local-network': InferProvider<typeof import('../capabilities/local-network.cap.js').localNetworkCapability>;
    'mesh-network': InferProvider<typeof import('../capabilities/mesh-network.cap.js').meshNetworkCapability>;
    'mesh-orchestrator': InferProvider<typeof import('../capabilities/mesh-orchestrator.cap.js').meshOrchestratorCapability>;
    'alerts': InferProvider<typeof import('../capabilities/alerts.cap.js').alertsCapability>;
    'backup': InferProvider<typeof import('../capabilities/backup.cap.js').backupCapability>;
    'network-access': INetworkAccessProvider;
    'streaming-engine': IStreamingEngine;
    'advanced-notifier': IAdvancedNotifier;
    'pipeline-executor': IPipelineExecutorProvider;
    'detection-pipeline': InferProvider<typeof import('../capabilities/detection-pipeline.cap.js').detectionPipelineCapability>;
    'pipeline-orchestrator': IPipelineOrchestratorProvider;
    'pipeline-runner': IPipelineRunnerProvider;
    'motion-detection': InferProvider<typeof import('../capabilities/motion-detection.cap.js').motionDetectionCapability>;
    'embedding-encoder': IEmbeddingEncoder;
    'decoder': IDecoderProvider;
    'audio-analyzer': InferProvider<typeof import('../capabilities/audio-analyzer.cap.js').audioAnalyzerCapability>;
    'audio-analysis': InferProvider<typeof import('../capabilities/audio-analysis.cap.js').audioAnalysisCapability>;
    'audio-codec': InferProvider<typeof import('../capabilities/audio-codec.cap.js').audioCodecCapability>;
    'addon-settings': InferProvider<typeof import('../capabilities/addon-settings.cap.js').addonSettingsCapability>;
    'settings-store': ISettingsBackend;
    'embeddings': IEmbeddingsBackend;
    'snapshot': ISnapshotOrchestrator;
    'snapshot-provider': InferProvider<typeof import('../capabilities/snapshot-provider.cap.js').snapshotProviderCapability>;
    'metrics-provider': InferProvider<typeof import('../capabilities/metrics-provider.cap.js').metricsProviderCapability>;
    'camera-streams': InferProvider<typeof import('../capabilities/camera-streams.cap.js').cameraStreamsCapability>;
    'webrtc-session': InferProvider<typeof import('../capabilities/webrtc-session.cap.js').webrtcSessionCapability>;
    'accessories': InferProvider<typeof import('../capabilities/accessories.cap.js').accessoriesCapability>;
    'battery': InferProvider<typeof import('../capabilities/battery.cap.js').batteryCapability>;
    'doorbell': InferProvider<typeof import('../capabilities/doorbell.cap.js').doorbellCapability>;
    'intercom': InferProvider<typeof import('../capabilities/intercom.cap.js').intercomCapability>;
    'switch': InferProvider<typeof import('../capabilities/switch.cap.js').switchCapability>;
    'osd': InferProvider<typeof import('../capabilities/osd.cap.js').osdCapability>;
    'ptz': InferProvider<typeof import('../capabilities/ptz.cap.js').ptzCapability>;
    'ptz-autotrack': InferProvider<typeof import('../capabilities/ptz-autotrack.cap.js').ptzAutotrackCapability>;
    'reboot': InferProvider<typeof import('../capabilities/reboot.cap.js').rebootCapability>;
    'device-discovery': InferProvider<typeof import('../capabilities/device-discovery.cap.js').deviceDiscoveryCapability>;
    'brightness': InferProvider<typeof import('../capabilities/brightness.cap.js').brightnessCapability>;
    'motion-trigger': InferProvider<typeof import('../capabilities/motion-trigger.cap.js').motionTriggerCapability>;
    'recording': InferProvider<typeof import('../capabilities/recording.cap.js').recordingCapability>;
    'zones': InferProvider<typeof import('../capabilities/zones.cap.js').zonesCapability>;
    'zone-rules': InferProvider<typeof import('../capabilities/zone-rules.cap.js').zoneRulesCapability>;
    'zone-analytics': InferProvider<typeof import('../capabilities/zone-analytics.cap.js').zoneAnalyticsCapability>;
    'audio-metrics': InferProvider<typeof import('../capabilities/audio-metrics.cap.js').audioMetricsCapability>;
    'motion': InferProvider<typeof import('../capabilities/motion.cap.js').motionCapability>;
    'events': InferProvider<typeof import('../capabilities/events.cap.js').eventsCapability>;
    'native-object-detection': InferProvider<typeof import('../capabilities/native-object-detection.cap.js').nativeObjectDetectionCapability>;
    'device-ops': InferProvider<typeof import('../capabilities/device-ops.cap.js').deviceOpsCapability>;
    'system': InferProvider<typeof import('../capabilities/system.cap.js').systemCapability>;
    'network-quality': InferProvider<typeof import('../capabilities/network-quality.cap.js').networkQualityCapability>;
    'toast': InferProvider<typeof import('../capabilities/toast.cap.js').toastCapability>;
    'nodes': InferProvider<typeof import('../capabilities/nodes.cap.js').nodesCapability>;
    'integrations': InferProvider<typeof import('../capabilities/integrations.cap.js').integrationsCapability>;
    'addons': InferProvider<typeof import('../capabilities/addons.cap.js').addonsCapability>;
    'authentication': InferProvider<typeof import('../capabilities/authentication.cap.js').authenticationCapability>;
    'remote-access': InferProvider<typeof import('../capabilities/remote-access.cap.js').remoteAccessCapability>;
    'turn-orchestrator': InferProvider<typeof import('../capabilities/turn-orchestrator.cap.js').turnOrchestratorCapability>;
    'turn-provider': InferProvider<typeof import('../capabilities/turn-provider.cap.js').turnProviderCapability>;
    'storage-provider': InferProvider<typeof import('../capabilities/storage-provider.cap.js').storageProviderCapability>;
    'camera-credentials': InferProvider<typeof import('../capabilities/camera-credentials.cap.js').cameraCredentialsCapability>;
    'device-status': InferProvider<typeof import('../capabilities/device-status.cap.js').deviceStatusCapability>;
    'feature-probe': InferProvider<typeof import('../capabilities/feature-probe.cap.js').featureProbeCapability>;
}
/**
 * Capability provider map filtered to capabilities declared as `singleton`
 * in their `.cap.ts` definition. Derived at compile time from the generated
 * `SingletonCapabilityName` union and the hand-curated `CapabilityProviderMap`.
 *
 * Consumers that need to narrow a getter should use this type to express
 * intent: `getSingleton<K extends keyof SingletonCapabilityMap>(name: K)`.
 * A cap declared as collection will be rejected at the type level even if
 * it exists in `CapabilityProviderMap`.
 *
 * Introduced in session 5 Sprint A5 to unblock hard-typed registry getters.
 */
export type SingletonCapabilityMap = {
    [K in SingletonCapabilityName as K extends keyof CapabilityProviderMap ? K : never]: K extends keyof CapabilityProviderMap ? CapabilityProviderMap[K] : never;
};
/**
 * Capability provider map filtered to capabilities declared as `collection`
 * in their `.cap.ts` definition. Counterpart to `SingletonCapabilityMap`.
 */
export type CollectionCapabilityMap = {
    [K in CollectionCapabilityName as K extends keyof CapabilityProviderMap ? K : never]: K extends keyof CapabilityProviderMap ? CapabilityProviderMap[K] : never;
};
//# sourceMappingURL=capability.d.ts.map