import type { z } from 'zod';
import type { DeviceType } from './device-type.js';
import type { IDevice } from './device.js';
export interface DeviceManualCreation {
    getChildCreationSchema(type: DeviceType): z.ZodObject<z.core.$ZodLooseShape>;
    createDevice(type: DeviceType, config: unknown): Promise<IDevice>;
}
export interface DeviceDiscovery {
    discoverDevices(): Promise<readonly DiscoveredDevice[]>;
    adoptDiscoveredDevice(candidate: DiscoveredDevice): Promise<IDevice>;
}
export interface DiscoveredDevice {
    readonly stableId: string;
    readonly type: DeviceType;
    readonly suggestedName: string;
    readonly prefilledConfig: Record<string, unknown>;
}
export interface SavedDevice {
    /** Numeric id reserved at allocateDeviceId time. */
    readonly id: number;
    /** External-system identifier — passed to `kernel.devices.create()`. */
    readonly stableId: string;
    readonly type: DeviceType;
    readonly name: string;
    /**
     * Operator-organisational label (room / location / area). `null`
     * when unset. Free-text — providers don't interpret it; the UI
     * groups devices by this field for "show me all cameras in
     * Kitchen" filters.
     */
    readonly location: string | null;
    /**
     * Soft-disabled flag. When `true`, the device class is still
     * instantiated and visible in the UI (so the operator can flip it
     * back on without re-adding) but lifecycle hooks
     * (publishToBroker, alarm-stream subscribe, …) are gated off by
     * BaseDevice. Used for "this camera is in maintenance" without
     * destroying its persisted config + bindings + per-device settings.
     */
    readonly disabled: boolean;
    readonly parentDeviceId: number | null;
    readonly config: Record<string, unknown>;
}
/**
 * Read-only snapshot of the device-meta surface, exposed on
 * `DeviceContext.deviceMeta`. The kernel populates it before the
 * device class constructor runs so `BaseDevice` can resolve
 * `name` / `location` / `disabled` without each subclass
 * duplicating those fields in its config schema.
 *
 * Mutations go through `kernel.devices.{setName,setLocation,
 * setDisabled}` — never through `applySettingsPatch`. The two
 * surfaces are deliberately disjoint: `meta` is operator-organisational
 * (free-text labels, on/off toggle), `config` is hardware-specific
 * (host, port, credentials, debug flags, deviceCache).
 */
/**
 * Free-form device metadata — hardware identity + driver-populated
 * facts the operator can both read and edit. Mirrors Scrypted's
 * `info: { manufacturer, model, serialNumber, ... }` device-level
 * surface but stored as a single JSON blob so future fields (HA
 * matter id, ONVIF profile token, …) don't require schema changes.
 *
 * Conventional keys (drivers should populate when known):
 *   - `manufacturer`  e.g. 'Reolink'
 *   - `model`         e.g. 'Argus PT Ultra'
 *   - `serialNumber`
 *   - `firmware`      software version
 *   - `hardware`      hardware revision
 *   - `mac`           MAC address
 *   - `uid`           vendor-specific globally-unique id (Reolink, etc.)
 *
 * Anything else the driver knows can land alongside (`onvifProfile`,
 * `ipAddress`, `apiPort`, …). All values must be JSON-serializable.
 */
export type DeviceMetadata = Record<string, unknown>;
export interface DeviceMeta {
    readonly id: number;
    readonly stableId: string;
    readonly addonId: string;
    readonly type: DeviceType;
    readonly name: string;
    readonly location: string | null;
    readonly disabled: boolean;
    readonly parentDeviceId: number | null;
    /** Hardware + identity blob; null when nothing has been populated yet. */
    readonly metadata: DeviceMetadata | null;
}
/**
 * Initial meta a provider supplies on `onCreateDevice`. Differs
 * from `DeviceMeta` in that `id` / `stableId` / `addonId` are
 * kernel-allocated, not operator-supplied.
 */
export interface InitialDeviceMeta {
    readonly type: DeviceType;
    readonly name: string;
    readonly location?: string | null;
}
/**
 * Single-call payload returned by `BaseDeviceProvider.onCreateDevice`.
 * Splits operator-organisational labels (`meta`) from hardware-
 * specific config (`config`) — kernel handles the rest:
 * stableId allocation, persistence, instantiation, register.
 *
 * `onAfterCreate` is the escape hatch for providers that need to
 * inject creation-time-only state into the freshly-built device
 * (e.g. Reolink's autodetect handshake hands a live Baichuan API
 * instance; adoption skips a second login). Fires AFTER `register`
 * + `device.onCreated` + accessory auto-spawn complete — the
 * device is fully alive when the callback runs. Best-effort:
 * failures log but don't unwind the already-registered device.
 */
export interface CreateDeviceSpec {
    readonly meta: InitialDeviceMeta;
    readonly config: Record<string, unknown>;
    readonly onAfterCreate?: (device: IDevice) => Promise<void> | void;
}
//# sourceMappingURL=device-management.d.ts.map