import { JSONObject, KDocumentContent } from "kuzzle-sdk"; import { Metadata } from "../../../modules/shared"; import { AssetMeasureContext } from "../../../modules/asset"; interface AbstractMeasureOrigin { /** * Origin of the measure */ type: string; /** * Payload uuids that were used to create this measure. */ payloadUuids: Array; /** * Custom metadata provided by the user */ metadata?: Metadata; } export interface MeasureOriginDevice extends AbstractMeasureOrigin { type: "device"; /** * Model of the device * * @example "AbeewayTemp" */ deviceModel: string; /** * Name of the measure */ measureName: string; /** * Reference of the device */ reference: string; /** * Origin device metadata */ deviceMetadata?: Metadata; /** * Device ID */ _id: string; } export interface MeasureOriginComputed extends AbstractMeasureOrigin { /** * Computed measures are not automatically added into the asset and device * documents at the end of the ingestion pipeline. */ type: "computed"; /** * Name of the measure */ measureName: string; /** * String that identify the rule used to compute the measure */ _id: string; } export interface MeasureOriginApi extends AbstractMeasureOrigin { type: "api"; apiMetadata?: Metadata; /** * API ID */ _id: string; } export type MeasureOrigin = MeasureOriginDevice | MeasureOriginComputed | MeasureOriginApi; /** * Represents the content of a measure document. */ export interface MeasureContent extends Measurement, KDocumentContent { /** * Asset linked to the device when the measure was made */ asset?: AssetMeasureContext; /** * Define the origin of the measure. */ origin: MeasureOrigin; } export type Measurement = { /** * Type of the measure. (e.g. "temperature") */ type: string; /** * Micro Timestamp of the measurement time. */ measuredAt: number; /** * Property containing the actual measurement. * * This should be specialized by child interfaces. */ values: TMeasureValues; }; /** * Used in the DecodedPayload to store a decoded measure */ export type DecodedMeasurement = { measureName: string; } & Measurement; export {};