import { z } from 'zod';
import { type InferProvider } from './capability-definition.js';
import { DeviceType } from '../device/device-type.js';
/**
 * pipeline-analytics — device-scoped wrapper cap. Refines raw
 * per-frame detections emitted by the pipeline runner into tracked
 * objects, per-kind event collections (motion / object / audio), and
 * persisted media. Owns the post-detection domain end-to-end:
 *
 *   runner emits PipelineInferenceResult
 *     ↓ (event bus)
 *   pipeline-analytics subscriber
 *     ↓ SORT tracker + zone engine + state analyzer + event emitter
 *   → three DB collections (one per kind), one FS media tree, one
 *     unified event emitter (FrameTracked + TrackStarted/Ended +
 *     DetectionEvent on bus)
 *
 * Pure subscriber model. No `processFrame` cap method — the runner
 * already publishes the raw frame on the bus. The cap surface is
 * only QUERIES + per-device settings, bound on/off via
 * `device-manager.setWrapperActive`. `defaultActive: true` because
 * every camera with a detection pipeline wants its raw detections
 * refined; operators opt out per-device via BindingsTab when needed.
 *
 * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
 * (per-device surface) and `track-trail` caps — see P11 cleanup.
 */
declare const TrackStateSchema: z.ZodEnum<{
    moving: "moving";
    left: "left";
    idle: "idle";
    new: "new";
    entered: "entered";
}>;
export type TrackState = z.infer<typeof TrackStateSchema>;
declare const EventKindSchema: z.ZodEnum<{
    object: "object";
    audio: "audio";
    motion: "motion";
}>;
export type EventKind = z.infer<typeof EventKindSchema>;
declare const TrackSchema: z.ZodObject<{
    trackId: z.ZodString;
    deviceId: z.ZodNumber;
    className: z.ZodString;
    label: z.ZodOptional<z.ZodString>;
    firstSeen: z.ZodNumber;
    lastSeen: z.ZodNumber;
    positions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
        x: z.ZodNumber;
        y: z.ZodNumber;
        timestamp: z.ZodNumber;
        bbox: z.ZodObject<{
            x: z.ZodNumber;
            y: z.ZodNumber;
            w: z.ZodNumber;
            h: z.ZodNumber;
        }, z.core.$strip>;
    }, z.core.$strip>>>;
    snapshots: z.ZodReadonly<z.ZodArray<z.ZodObject<{
        timestamp: z.ZodNumber;
        position: z.ZodObject<{
            x: z.ZodNumber;
            y: z.ZodNumber;
            timestamp: z.ZodNumber;
            bbox: z.ZodObject<{
                x: z.ZodNumber;
                y: z.ZodNumber;
                w: z.ZodNumber;
                h: z.ZodNumber;
            }, z.core.$strip>;
        }, z.core.$strip>;
        mediaKey: z.ZodString;
    }, z.core.$strip>>>;
    zonesVisited: z.ZodReadonly<z.ZodArray<z.ZodString>>;
    totalDistance: z.ZodNumber;
    state: z.ZodEnum<{
        moving: "moving";
        left: "left";
        idle: "idle";
        new: "new";
        entered: "entered";
    }>;
    active: z.ZodBoolean;
}, z.core.$strip>;
export type Track = z.infer<typeof TrackSchema>;
declare const MotionEventSchema: z.ZodObject<{
    kind: z.ZodLiteral<"motion">;
    regionCount: z.ZodNumber;
    regions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
        bbox: z.ZodObject<{
            x: z.ZodNumber;
            y: z.ZodNumber;
            w: z.ZodNumber;
            h: z.ZodNumber;
        }, z.core.$strip>;
        pixelCount: z.ZodNumber;
        intensity: z.ZodNumber;
    }, z.core.$strip>>>;
    frameWidth: z.ZodNumber;
    frameHeight: z.ZodNumber;
    id: z.ZodString;
    deviceId: z.ZodNumber;
    timestamp: z.ZodNumber;
}, z.core.$strip>;
export type MotionEvent = z.infer<typeof MotionEventSchema>;
declare const ObjectEventSchema: z.ZodObject<{
    kind: z.ZodLiteral<"object">;
    trackId: z.ZodString;
    className: z.ZodString;
    label: z.ZodOptional<z.ZodString>;
    confidence: z.ZodNumber;
    bbox: z.ZodObject<{
        x: z.ZodNumber;
        y: z.ZodNumber;
        w: z.ZodNumber;
        h: z.ZodNumber;
    }, z.core.$strip>;
    zones: z.ZodReadonly<z.ZodArray<z.ZodString>>;
    state: z.ZodEnum<{
        moving: "moving";
        left: "left";
        idle: "idle";
        new: "new";
        entered: "entered";
    }>;
    mediaKey: z.ZodOptional<z.ZodString>;
    id: z.ZodString;
    deviceId: z.ZodNumber;
    timestamp: z.ZodNumber;
}, z.core.$strip>;
export type ObjectEvent = z.infer<typeof ObjectEventSchema>;
declare const AudioEventSchema: z.ZodObject<{
    kind: z.ZodLiteral<"audio">;
    rms: z.ZodNumber;
    dbfs: z.ZodNumber;
    classification: z.ZodOptional<z.ZodObject<{
        className: z.ZodString;
        originalClass: z.ZodOptional<z.ZodString>;
        score: z.ZodNumber;
    }, z.core.$strip>>;
    id: z.ZodString;
    deviceId: z.ZodNumber;
    timestamp: z.ZodNumber;
}, z.core.$strip>;
export type AudioEvent = z.infer<typeof AudioEventSchema>;
declare const MediaFileSchema: z.ZodObject<{
    key: z.ZodString;
    kind: z.ZodEnum<{
        snapshot: "snapshot";
        crop: "crop";
        thumbnail: "thumbnail";
    }>;
    base64: z.ZodString;
    sizeBytes: z.ZodNumber;
    timestamp: z.ZodNumber;
}, z.core.$strip>;
export type MediaFile = z.infer<typeof MediaFileSchema>;
declare const TrackedDetectionSchema: z.ZodObject<{
    trackId: z.ZodString;
    className: z.ZodString;
    confidence: z.ZodNumber;
    bbox: z.ZodObject<{
        x: z.ZodNumber;
        y: z.ZodNumber;
        w: z.ZodNumber;
        h: z.ZodNumber;
    }, z.core.$strip>;
    zones: z.ZodReadonly<z.ZodArray<z.ZodString>>;
    state: z.ZodEnum<{
        moving: "moving";
        left: "left";
        idle: "idle";
        new: "new";
        entered: "entered";
    }>;
}, z.core.$strip>;
export declare const pipelineAnalyticsCapability: {
    readonly name: "pipeline-analytics";
    readonly scope: "device";
    readonly mode: "singleton";
    readonly deviceTypes: readonly [DeviceType.Camera];
    readonly exposesDeviceSettings: true;
    readonly methods: {
        readonly getActiveTracks: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            deviceId: z.ZodNumber;
        }, z.core.$strip>, z.ZodReadonly<z.ZodArray<z.ZodObject<{
            trackId: z.ZodString;
            deviceId: z.ZodNumber;
            className: z.ZodString;
            label: z.ZodOptional<z.ZodString>;
            firstSeen: z.ZodNumber;
            lastSeen: z.ZodNumber;
            positions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
                x: z.ZodNumber;
                y: z.ZodNumber;
                timestamp: z.ZodNumber;
                bbox: z.ZodObject<{
                    x: z.ZodNumber;
                    y: z.ZodNumber;
                    w: z.ZodNumber;
                    h: z.ZodNumber;
                }, z.core.$strip>;
            }, z.core.$strip>>>;
            snapshots: z.ZodReadonly<z.ZodArray<z.ZodObject<{
                timestamp: z.ZodNumber;
                position: z.ZodObject<{
                    x: z.ZodNumber;
                    y: z.ZodNumber;
                    timestamp: z.ZodNumber;
                    bbox: z.ZodObject<{
                        x: z.ZodNumber;
                        y: z.ZodNumber;
                        w: z.ZodNumber;
                        h: z.ZodNumber;
                    }, z.core.$strip>;
                }, z.core.$strip>;
                mediaKey: z.ZodString;
            }, z.core.$strip>>>;
            zonesVisited: z.ZodReadonly<z.ZodArray<z.ZodString>>;
            totalDistance: z.ZodNumber;
            state: z.ZodEnum<{
                moving: "moving";
                left: "left";
                idle: "idle";
                new: "new";
                entered: "entered";
            }>;
            active: z.ZodBoolean;
        }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
        readonly getTrack: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            deviceId: z.ZodNumber;
            trackId: z.ZodString;
        }, z.core.$strip>, z.ZodNullable<z.ZodObject<{
            trackId: z.ZodString;
            deviceId: z.ZodNumber;
            className: z.ZodString;
            label: z.ZodOptional<z.ZodString>;
            firstSeen: z.ZodNumber;
            lastSeen: z.ZodNumber;
            positions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
                x: z.ZodNumber;
                y: z.ZodNumber;
                timestamp: z.ZodNumber;
                bbox: z.ZodObject<{
                    x: z.ZodNumber;
                    y: z.ZodNumber;
                    w: z.ZodNumber;
                    h: z.ZodNumber;
                }, z.core.$strip>;
            }, z.core.$strip>>>;
            snapshots: z.ZodReadonly<z.ZodArray<z.ZodObject<{
                timestamp: z.ZodNumber;
                position: z.ZodObject<{
                    x: z.ZodNumber;
                    y: z.ZodNumber;
                    timestamp: z.ZodNumber;
                    bbox: z.ZodObject<{
                        x: z.ZodNumber;
                        y: z.ZodNumber;
                        w: z.ZodNumber;
                        h: z.ZodNumber;
                    }, z.core.$strip>;
                }, z.core.$strip>;
                mediaKey: z.ZodString;
            }, z.core.$strip>>>;
            zonesVisited: z.ZodReadonly<z.ZodArray<z.ZodString>>;
            totalDistance: z.ZodNumber;
            state: z.ZodEnum<{
                moving: "moving";
                left: "left";
                idle: "idle";
                new: "new";
                entered: "entered";
            }>;
            active: z.ZodBoolean;
        }, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
        /** Historical completed tracks for a device. Queried from the
         *  persisted `pipeline-analytics:tracks` collection; active tracks
         *  still in RAM are not included. */
        readonly listTracks: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            deviceId: z.ZodNumber;
            since: z.ZodOptional<z.ZodNumber>;
            until: z.ZodOptional<z.ZodNumber>;
            limit: z.ZodOptional<z.ZodNumber>;
        }, z.core.$strip>, z.ZodReadonly<z.ZodArray<z.ZodObject<{
            trackId: z.ZodString;
            deviceId: z.ZodNumber;
            className: z.ZodString;
            label: z.ZodOptional<z.ZodString>;
            firstSeen: z.ZodNumber;
            lastSeen: z.ZodNumber;
            positions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
                x: z.ZodNumber;
                y: z.ZodNumber;
                timestamp: z.ZodNumber;
                bbox: z.ZodObject<{
                    x: z.ZodNumber;
                    y: z.ZodNumber;
                    w: z.ZodNumber;
                    h: z.ZodNumber;
                }, z.core.$strip>;
            }, z.core.$strip>>>;
            snapshots: z.ZodReadonly<z.ZodArray<z.ZodObject<{
                timestamp: z.ZodNumber;
                position: z.ZodObject<{
                    x: z.ZodNumber;
                    y: z.ZodNumber;
                    timestamp: z.ZodNumber;
                    bbox: z.ZodObject<{
                        x: z.ZodNumber;
                        y: z.ZodNumber;
                        w: z.ZodNumber;
                        h: z.ZodNumber;
                    }, z.core.$strip>;
                }, z.core.$strip>;
                mediaKey: z.ZodString;
            }, z.core.$strip>>>;
            zonesVisited: z.ZodReadonly<z.ZodArray<z.ZodString>>;
            totalDistance: z.ZodNumber;
            state: z.ZodEnum<{
                moving: "moving";
                left: "left";
                idle: "idle";
                new: "new";
                entered: "entered";
            }>;
            active: z.ZodBoolean;
        }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
        readonly clearTracks: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            deviceId: z.ZodNumber;
        }, z.core.$strip>, z.ZodVoid, "mutation">;
        readonly getMotionEvents: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            deviceId: z.ZodNumber;
            since: z.ZodOptional<z.ZodNumber>;
            until: z.ZodOptional<z.ZodNumber>;
            limit: z.ZodDefault<z.ZodNumber>;
        }, z.core.$strip>, z.ZodReadonly<z.ZodArray<z.ZodObject<{
            kind: z.ZodLiteral<"motion">;
            regionCount: z.ZodNumber;
            regions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
                bbox: z.ZodObject<{
                    x: z.ZodNumber;
                    y: z.ZodNumber;
                    w: z.ZodNumber;
                    h: z.ZodNumber;
                }, z.core.$strip>;
                pixelCount: z.ZodNumber;
                intensity: z.ZodNumber;
            }, z.core.$strip>>>;
            frameWidth: z.ZodNumber;
            frameHeight: z.ZodNumber;
            id: z.ZodString;
            deviceId: z.ZodNumber;
            timestamp: z.ZodNumber;
        }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
        readonly getObjectEvents: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            deviceId: z.ZodNumber;
            since: z.ZodOptional<z.ZodNumber>;
            until: z.ZodOptional<z.ZodNumber>;
            limit: z.ZodDefault<z.ZodNumber>;
            classFilter: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>, z.ZodReadonly<z.ZodArray<z.ZodObject<{
            kind: z.ZodLiteral<"object">;
            trackId: z.ZodString;
            className: z.ZodString;
            label: z.ZodOptional<z.ZodString>;
            confidence: z.ZodNumber;
            bbox: z.ZodObject<{
                x: z.ZodNumber;
                y: z.ZodNumber;
                w: z.ZodNumber;
                h: z.ZodNumber;
            }, z.core.$strip>;
            zones: z.ZodReadonly<z.ZodArray<z.ZodString>>;
            state: z.ZodEnum<{
                moving: "moving";
                left: "left";
                idle: "idle";
                new: "new";
                entered: "entered";
            }>;
            mediaKey: z.ZodOptional<z.ZodString>;
            id: z.ZodString;
            deviceId: z.ZodNumber;
            timestamp: z.ZodNumber;
        }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
        readonly getAudioEvents: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            deviceId: z.ZodNumber;
            since: z.ZodOptional<z.ZodNumber>;
            until: z.ZodOptional<z.ZodNumber>;
            limit: z.ZodDefault<z.ZodNumber>;
        }, z.core.$strip>, z.ZodReadonly<z.ZodArray<z.ZodObject<{
            kind: z.ZodLiteral<"audio">;
            rms: z.ZodNumber;
            dbfs: z.ZodNumber;
            classification: z.ZodOptional<z.ZodObject<{
                className: z.ZodString;
                originalClass: z.ZodOptional<z.ZodString>;
                score: z.ZodNumber;
            }, z.core.$strip>>;
            id: z.ZodString;
            deviceId: z.ZodNumber;
            timestamp: z.ZodNumber;
        }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
        readonly getEventMedia: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            eventId: z.ZodString;
        }, z.core.$strip>, z.ZodReadonly<z.ZodArray<z.ZodObject<{
            key: z.ZodString;
            kind: z.ZodEnum<{
                snapshot: "snapshot";
                crop: "crop";
                thumbnail: "thumbnail";
            }>;
            base64: z.ZodString;
            sizeBytes: z.ZodNumber;
            timestamp: z.ZodNumber;
        }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
        readonly getTrackMedia: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            trackId: z.ZodString;
        }, z.core.$strip>, z.ZodReadonly<z.ZodArray<z.ZodObject<{
            key: z.ZodString;
            kind: z.ZodEnum<{
                snapshot: "snapshot";
                crop: "crop";
                thumbnail: "thumbnail";
            }>;
            base64: z.ZodString;
            sizeBytes: z.ZodNumber;
            timestamp: z.ZodNumber;
        }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
    };
    readonly events: {
        /**
         * Enriched frame emitted after refinement. Carries lightweight
         * tracked-detection metadata (track id, class, zones, state) so
         * downstream consumers (stream overlays, notifications) can
         * annotate without querying full Track state.
         */
        readonly onFrameTracked: {
            readonly data: z.ZodObject<{
                deviceId: z.ZodNumber;
                timestamp: z.ZodNumber;
                frameWidth: z.ZodNumber;
                frameHeight: z.ZodNumber;
                detections: z.ZodReadonly<z.ZodArray<z.ZodObject<{
                    trackId: z.ZodString;
                    className: z.ZodString;
                    confidence: z.ZodNumber;
                    bbox: z.ZodObject<{
                        x: z.ZodNumber;
                        y: z.ZodNumber;
                        w: z.ZodNumber;
                        h: z.ZodNumber;
                    }, z.core.$strip>;
                    zones: z.ZodReadonly<z.ZodArray<z.ZodString>>;
                    state: z.ZodEnum<{
                        moving: "moving";
                        left: "left";
                        idle: "idle";
                        new: "new";
                        entered: "entered";
                    }>;
                }, z.core.$strip>>>;
            }, z.core.$strip>;
        };
        /** Track entered active state (first-seen). */
        readonly onTrackStarted: {
            readonly data: z.ZodObject<{
                deviceId: z.ZodNumber;
                trackId: z.ZodString;
                className: z.ZodString;
            }, z.core.$strip>;
        };
        /** Track expired (TTL reached after last detection). */
        readonly onTrackEnded: {
            readonly data: z.ZodObject<{
                deviceId: z.ZodNumber;
                trackId: z.ZodString;
                className: z.ZodString;
                durationMs: z.ZodNumber;
            }, z.core.$strip>;
        };
        /** Canonical "something happened at device X" event, per-kind. */
        readonly onDetectionEvent: {
            readonly data: z.ZodObject<{
                deviceId: z.ZodNumber;
                kind: z.ZodEnum<{
                    object: "object";
                    audio: "audio";
                    motion: "motion";
                }>;
                eventId: z.ZodString;
                timestamp: z.ZodNumber;
            }, z.core.$strip>;
        };
    };
};
export type IPipelineAnalyticsProvider = InferProvider<typeof pipelineAnalyticsCapability>;
export { TrackStateSchema, EventKindSchema, TrackSchema, MotionEventSchema, ObjectEventSchema, AudioEventSchema, MediaFileSchema, TrackedDetectionSchema, };
//# sourceMappingURL=pipeline-analytics.cap.d.ts.map