import type { ActionId, StateId } from "./catalog.js"; import type { Schema } from "./schema.js"; import type { ActionsToDirective, Directives, Semantics, StatesToRange, StatesToValue } from "./types.js"; type Short = Id extends `${Prefix}${infer Name}` ? Name : never; /** A phrase by its id or by its name: "Alexa.Actions.Open" or "Open". */ export type ActionName = ActionId | Short; /** A state by its id or by its name: "Alexa.States.Closed" or "Closed". */ export type StateName = StateId | Short; /** * Collects the mappings of one capability: * * semantics() * .action("Close", "SetRangeValue", { rangeValue: 0 }) * .action(["Open", "Raise"], "SetRangeValue", { rangeValue: 100 }) * .state("Closed", 0) * .stateRange("Open", 1, 100) * * What is collected is checked when the capability is declared, against the directives and the property of its * interface. */ export declare class SemanticsBuilder implements Semantics { readonly actionMappings: ActionsToDirective[]; readonly stateMappings: Array; /** The phrases send the directive. payload is its payload; leave it out for a directive that has none. */ action(actions: ActionName | readonly ActionName[], directive: string, payload?: Record): this; /** The property at this value is in these states: "is the garage door open?" */ state(states: StateName | readonly StateName[], value: unknown): this; /** The property between the two values, both included, is in these states. For an interface with a numeric property. */ stateRange(states: StateName | readonly StateName[], minimumValue: number, maximumValue: number): this; } export declare function semantics(): SemanticsBuilder; export interface SemanticsRules { /** The directives of the interface: a mapping names one of them and gives its payload. */ directives: Directives; /** The value of the property a state stands for. */ stateValue: Schema; /** States can be mapped to a range of values: the property is a number. */ ranges?: boolean; /** * SetEcoOn, SetEcoOff, EcoOn and EcoOff can be mapped. "Semantics for Alexa hunches is supported only for * Alexa.ToggleController" (generic-controllers.html). */ hunches?: boolean; } /** The schema of the semantics option of one interface. It takes a semantics() builder or the object as discovery has it. */ export declare function semanticsOf({ directives, stateValue, ranges, hunches }: SemanticsRules): Schema; export {};