import { z } from 'zod';
import { type InferProvider } from './capability-definition.js';
import type { IStreamBroker } from '../interfaces/stream-broker.js';
/**
 * Per-broker RTSP restream entry. The broker exposes the public RTSP
 * restream URL for every active profile slot — consumers read the URL
 * here instead of constructing it from broker internals.
 */
declare const RtspRestreamEntrySchema: z.ZodObject<{
    brokerId: z.ZodString;
    url: z.ZodString;
    mutedUrl: z.ZodString;
    enabled: z.ZodBoolean;
}, z.core.$strip>;
/**
 * Individual-client shapes for the `listClients` roster. One row per
 * consumer of the chosen broker slot (profile) — RTSP sessions,
 * decoded-frame subscribers, audio chunks.
 */
export declare const BrokerRtspClientSchema: z.ZodObject<{
    sessionId: z.ZodString;
    remoteAddr: z.ZodString;
    playing: z.ZodBoolean;
    muted: z.ZodBoolean;
    connectedAt: z.ZodNumber;
    lastRtpAt: z.ZodNumber;
    bytesSent: z.ZodNumber;
}, z.core.$strip>;
export declare const BrokerDecodedClientSchema: z.ZodObject<{
    tag: z.ZodString;
    subscribedAt: z.ZodNumber;
    maxFps: z.ZodNumber;
    framesDelivered: z.ZodNumber;
    framesDropped: z.ZodNumber;
}, z.core.$strip>;
export declare const BrokerAudioClientSchema: z.ZodObject<{
    tag: z.ZodString;
    subscribedAt: z.ZodNumber;
    chunksDelivered: z.ZodNumber;
}, z.core.$strip>;
export declare const BrokerClientsSchema: z.ZodObject<{
    rtsp: z.ZodReadonly<z.ZodArray<z.ZodObject<{
        sessionId: z.ZodString;
        remoteAddr: z.ZodString;
        playing: z.ZodBoolean;
        muted: z.ZodBoolean;
        connectedAt: z.ZodNumber;
        lastRtpAt: z.ZodNumber;
        bytesSent: z.ZodNumber;
    }, z.core.$strip>>>;
    decoded: z.ZodReadonly<z.ZodArray<z.ZodObject<{
        tag: z.ZodString;
        subscribedAt: z.ZodNumber;
        maxFps: z.ZodNumber;
        framesDelivered: z.ZodNumber;
        framesDropped: z.ZodNumber;
    }, z.core.$strip>>>;
    audio: z.ZodReadonly<z.ZodArray<z.ZodObject<{
        tag: z.ZodString;
        subscribedAt: z.ZodNumber;
        chunksDelivered: z.ZodNumber;
    }, z.core.$strip>>>;
    pipeClients: z.ZodNumber;
    encodedSubscribers: z.ZodNumber;
}, z.core.$strip>;
export type BrokerRtspClient = z.infer<typeof BrokerRtspClientSchema>;
export type BrokerDecodedClient = z.infer<typeof BrokerDecodedClientSchema>;
export type BrokerAudioClient = z.infer<typeof BrokerAudioClientSchema>;
export type BrokerClients = z.infer<typeof BrokerClientsSchema>;
/**
 * Reason rendered by the broker's placeholder image while no live RTP
 * is flowing. Each value maps 1:1 to a pre-encoded H.264 keyframe in
 * `addon-stream-broker/.../placeholder-frames.ts`. Keep aligned with
 * `PlaceholderKind` over there — the union here is the public surface
 * (cap input + provider type) and is the single source of truth.
 */
export declare const PlaceholderReasonSchema: z.ZodEnum<{
    disabled: "disabled";
    reconnecting: "reconnecting";
    sleeping: "sleeping";
    offline: "offline";
    waking: "waking";
}>;
export type PlaceholderReason = z.infer<typeof PlaceholderReasonSchema>;
/**
 * Stream broker — system-wide singleton cap.
 *
 * Owns two registries per device:
 *   - `cameraStreams`: the pool of physical streams published by device
 *     providers (and potentially third-party addons, e.g. an RTMP
 *     discovery addon). Ephemeral: each provider re-publishes in its
 *     own `onInitialize`.
 *   - `profileMap`: persistent operator-intent mapping
 *     `{high?, mid?, low?} -> camStreamId`. Persisted in the broker's
 *     own storage, not in `device.config`.
 *
 * Up to 3 brokers per device keyed `${deviceId}/${profile}`. Each
 * broker ingests from the URL of the cam stream currently assigned via
 * `profileMap[profile]`. Changing the assignment tears down the broker
 * and rebuilds it against the new source — stream id seen by consumers
 * never changes.
 *
 * Per-device reads (what's published, what's assigned) live on the
 * device-scoped `camera-streams` cap, surfaced via `fetchDevice()`. The
 * methods below are either mutations or system-wide dumps.
 */
export declare const streamBrokerCapability: {
    readonly name: "stream-broker";
    readonly scope: "system";
    readonly mode: "singleton";
    readonly exposesDeviceSettings: true;
    readonly methods: {
        /**
         * Register a physical camera stream as an input option. Idempotent
         * for (deviceId, camStreamId) — re-publishing updates metadata
         * without disturbing profile assignments. The provider calls this
         * in `onInitialize` for each stream it offers. Third-party addons
         * may also publish (e.g. an RTMP discovery layer) — camstack has
         * no notion of "owner" beyond the (deviceId, camStreamId) key.
         */
        readonly publishCameraStream: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            deviceId: z.ZodNumber;
            camStreamId: z.ZodString;
            kind: z.ZodEnum<{
                "pull-rtsp": "pull-rtsp";
                "pull-rtmp": "pull-rtmp";
                "pull-http": "pull-http";
                "pull-rfc4571": "pull-rfc4571";
                "push-annexb": "push-annexb";
            }>;
            url: z.ZodOptional<z.ZodString>;
            codec: z.ZodOptional<z.ZodString>;
            resolution: z.ZodOptional<z.ZodObject<{
                width: z.ZodNumber;
                height: z.ZodNumber;
            }, z.core.$strip>>;
            fps: z.ZodOptional<z.ZodNumber>;
            label: z.ZodOptional<z.ZodString>;
            deviceFeatures: z.ZodOptional<z.ZodArray<z.ZodString>>;
            autoEligible: z.ZodOptional<z.ZodBoolean>;
            metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
        }, z.core.$strip>, z.ZodObject<{
            success: z.ZodLiteral<true>;
        }, z.core.$strip>, "mutation">;
        readonly retractCameraStream: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            deviceId: z.ZodNumber;
            camStreamId: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            success: z.ZodLiteral<true>;
        }, z.core.$strip>, "mutation">;
        /**
         * Assign a cam stream to a profile slot. Tears down any existing
         * broker for that slot and rebuilds against the new source. Persists
         * the choice — survives reboots.
         */
        readonly assignProfile: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            deviceId: z.ZodNumber;
            profile: z.ZodEnum<{
                high: "high";
                mid: "mid";
                low: "low";
            }>;
            camStreamId: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            success: z.ZodLiteral<true>;
        }, z.core.$strip>, "mutation">;
        readonly unassignProfile: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            deviceId: z.ZodNumber;
            profile: z.ZodEnum<{
                high: "high";
                mid: "mid";
                low: "low";
            }>;
        }, z.core.$strip>, z.ZodObject<{
            success: z.ZodLiteral<true>;
        }, z.core.$strip>, "mutation">;
        /**
         * Full dump of every published cam stream across every device.
         * For dashboards and cross-device tooling; per-device reads go
         * through the `camera-streams` cap on the device proxy.
         */
        readonly listAllCameraStreams: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodReadonly<z.ZodArray<z.ZodObject<{
            camStreamId: z.ZodString;
            deviceId: z.ZodNumber;
            kind: z.ZodEnum<{
                "pull-rtsp": "pull-rtsp";
                "pull-rtmp": "pull-rtmp";
                "pull-http": "pull-http";
                "pull-rfc4571": "pull-rfc4571";
                "push-annexb": "push-annexb";
            }>;
            url: z.ZodOptional<z.ZodString>;
            codec: z.ZodOptional<z.ZodString>;
            resolution: z.ZodOptional<z.ZodObject<{
                width: z.ZodNumber;
                height: z.ZodNumber;
            }, z.core.$strip>>;
            fps: z.ZodOptional<z.ZodNumber>;
            label: z.ZodOptional<z.ZodString>;
            deviceFeatures: z.ZodOptional<z.ZodArray<z.ZodString>>;
            autoEligible: z.ZodOptional<z.ZodBoolean>;
            metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
        }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
        readonly listAllProfileSlots: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodReadonly<z.ZodArray<z.ZodObject<{
            deviceId: z.ZodNumber;
            profile: z.ZodEnum<{
                high: "high";
                mid: "mid";
                low: "low";
            }>;
            brokerId: z.ZodString;
            sourceCamStreamId: z.ZodNullable<z.ZodString>;
            status: z.ZodEnum<{
                error: "error";
                streaming: "streaming";
                idle: "idle";
                connecting: "connecting";
                unassigned: "unassigned";
            }>;
            resolution: z.ZodOptional<z.ZodObject<{
                width: z.ZodNumber;
                height: z.ZodNumber;
            }, z.core.$strip>>;
            codec: z.ZodOptional<z.ZodString>;
            preBufferSec: z.ZodOptional<z.ZodNumber>;
            errorMessage: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
        readonly getBrokerStats: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            brokerId: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            status: z.ZodEnum<{
                error: "error";
                streaming: "streaming";
                stopped: "stopped";
                idle: "idle";
                connecting: "connecting";
            }>;
            inputFps: z.ZodNumber;
            decodeFps: z.ZodNumber;
            encodedSubscribers: z.ZodNumber;
            decodedSubscribers: z.ZodNumber;
            uptimeMs: z.ZodNumber;
            bitrateKbps: z.ZodNumber;
            idrIntervalMs: z.ZodNumber;
            codec: z.ZodOptional<z.ZodString>;
            totalBytes: z.ZodNumber;
            packetCount: z.ZodNumber;
            rtspClients: z.ZodNumber;
            pipeClients: z.ZodNumber;
            preBufferSec: z.ZodNumber;
            preBufferMs: z.ZodNumber;
            preBufferPackets: z.ZodNumber;
            decoderNodeId: z.ZodNullable<z.ZodString>;
            audio: z.ZodOptional<z.ZodNullable<z.ZodObject<{
                codec: z.ZodString;
                sampleRate: z.ZodNumber;
                channels: z.ZodNumber;
                supported: z.ZodBoolean;
            }, z.core.$strip>>>;
        }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
        readonly listClients: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            brokerId: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            rtsp: z.ZodReadonly<z.ZodArray<z.ZodObject<{
                sessionId: z.ZodString;
                remoteAddr: z.ZodString;
                playing: z.ZodBoolean;
                muted: z.ZodBoolean;
                connectedAt: z.ZodNumber;
                lastRtpAt: z.ZodNumber;
                bytesSent: z.ZodNumber;
            }, z.core.$strip>>>;
            decoded: z.ZodReadonly<z.ZodArray<z.ZodObject<{
                tag: z.ZodString;
                subscribedAt: z.ZodNumber;
                maxFps: z.ZodNumber;
                framesDelivered: z.ZodNumber;
                framesDropped: z.ZodNumber;
            }, z.core.$strip>>>;
            audio: z.ZodReadonly<z.ZodArray<z.ZodObject<{
                tag: z.ZodString;
                subscribedAt: z.ZodNumber;
                chunksDelivered: z.ZodNumber;
            }, z.core.$strip>>>;
            pipeClients: z.ZodNumber;
            encodedSubscribers: z.ZodNumber;
        }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
        readonly killClient: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            brokerId: z.ZodString;
            channel: z.ZodEnum<{
                audio: "audio";
                rtsp: "rtsp";
                decoded: "decoded";
            }>;
            handle: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            killed: z.ZodBoolean;
        }, z.core.$strip>, "mutation">;
        /** Rebuild the broker for a profile slot in place (re-dial source). */
        readonly restartProfile: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            deviceId: z.ZodNumber;
            profile: z.ZodEnum<{
                high: "high";
                mid: "mid";
                low: "low";
            }>;
        }, z.core.$strip>, z.ZodObject<{
            success: z.ZodBoolean;
        }, z.core.$strip>, "mutation">;
        readonly getStreamUrl: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            streamId: z.ZodString;
            format: z.ZodEnum<{
                rtsp: "rtsp";
                webrtc: "webrtc";
                hls: "hls";
                mjpeg: "mjpeg";
            }>;
        }, z.core.$strip>, z.ZodObject<{
            url: z.ZodString;
        }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
        /**
         * Return the live IStreamBroker instance for a given brokerId. Same
         * LOCAL-ONLY contract as before: callers (pipeline-runner) must be
         * co-located. BrokerId is `${deviceId}/${camStreamId}` — profile
         * lookup goes through `assignments` if a caller starts from a
         * profile.
         */
        readonly getBroker: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            brokerId: z.ZodString;
        }, z.core.$strip>, z.ZodCustom<IStreamBroker | null, IStreamBroker | null>, import("./capability-definition.js").CapabilityMethodKind>;
        readonly setPreBufferDuration: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            brokerId: z.ZodString;
            seconds: z.ZodNumber;
        }, z.core.$strip>, z.ZodVoid, "mutation">;
        readonly getPreBufferInfo: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            brokerId: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            configuredSec: z.ZodNumber;
            bufferedMs: z.ZodNumber;
            packetCount: z.ZodNumber;
        }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
        readonly getRtspPort: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodNumber, import("./capability-definition.js").CapabilityMethodKind>;
        readonly getAllRtspEntries: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            hostname: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>, z.ZodReadonly<z.ZodArray<z.ZodObject<{
            brokerId: z.ZodString;
            url: z.ZodString;
            mutedUrl: z.ZodString;
            enabled: z.ZodBoolean;
        }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
        readonly getRtspEntry: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            brokerId: z.ZodString;
            hostname: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>, z.ZodNullable<z.ZodObject<{
            brokerId: z.ZodString;
            url: z.ZodString;
            mutedUrl: z.ZodString;
            enabled: z.ZodBoolean;
        }, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
        readonly regenerateRtspToken: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            brokerId: z.ZodString;
        }, z.core.$strip>, z.ZodNullable<z.ZodString>, "mutation">;
        readonly setRtspEnabled: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            brokerId: z.ZodString;
            enabled: z.ZodBoolean;
        }, z.core.$strip>, z.ZodVoid, "mutation">;
        readonly isRtspEnabled: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
            brokerId: z.ZodString;
        }, z.core.$strip>, z.ZodBoolean, import("./capability-definition.js").CapabilityMethodKind>;
    };
    readonly events: {
        /**
         * Emitted when a profile starts consuming a push-kind cam stream.
         * Push-kind providers (e.g. Reolink Baichuan native streams)
         * subscribe and begin emitting packets only on demand — battery
         * cams stay asleep until someone actually watches.
         */
        readonly onCamStreamDemand: import("./capability-definition.js").CapabilityEventSchema<z.ZodObject<{
            deviceId: z.ZodNumber;
            camStreamId: z.ZodString;
            profile: z.ZodEnum<{
                high: "high";
                mid: "mid";
                low: "low";
            }>;
        }, z.core.$strip>>;
        /**
         * Emitted when the last profile consuming a push-kind cam stream
         * releases it. Providers tear down upstream connections on this
         * signal.
         */
        readonly onCamStreamIdle: import("./capability-definition.js").CapabilityEventSchema<z.ZodObject<{
            deviceId: z.ZodNumber;
            camStreamId: z.ZodString;
        }, z.core.$strip>>;
        /**
         * Emitted by a broker that failed to dial a managed-loopback
         * source (today: `pull-rfc4571`). The publisher's transport (e.g.
         * the Reolink lib's RFC 4571 TCP server) idle-tears-down after
         * ~15s with no clients and may rebind to a different port on
         * recreate, leaving the URL the broker has cached stale. The owning
         * camera provider re-runs its publish pipeline on receipt — that
         * call self-heals the loopback server (`ensureRfc4571Server`) and
         * `publishCameraStream` propagates the fresh URL back into the
         * broker's source resolver.
         */
        readonly onRequestStreamSourceRefresh: import("./capability-definition.js").CapabilityEventSchema<z.ZodObject<{
            deviceId: z.ZodNumber;
            camStreamId: z.ZodString;
            brokerId: z.ZodString;
        }, z.core.$strip>>;
    };
};
export type IStreamBrokerProvider = InferProvider<typeof streamBrokerCapability>;
export { RtspRestreamEntrySchema };
//# sourceMappingURL=stream-broker.cap.d.ts.map