Interface AvailabilityModel<AdditionalData, Properties>

Represents the nodes of the Beverage Availability graph for a nozzle.

Example: The base GraphNode from the backend will have an id, type, available and visible properties. However,

a given implementation might extend the Beverage Graph node to include additional data, such as the beverage name or an image url. This additional data would be added to the node and would be represented by the AdditionalData type parameter.

const model: AvailabilityModel<{icon: string}> = ...;

would allow for visibility of all the base properties as well as the additional data (icon) that might be on the message payload from the backend.

interface AvailabilityModel<AdditionalData, Properties> {
    available: boolean;
    altId: string;
    rawId: string;
    visible: boolean;
    type: string;
    id: string;
    updateModel(options): void;
    updateAvailability(available): void;
}

Type Parameters

  • AdditionalData extends object = any

    Any additional data that is added to a node at the application layer.

  • Properties extends Record<string, any> = Record<string, any>

Hierarchy

Properties

available: boolean

is the node available as calculated by the Pour Engine

altId: string

Return the alternate id for the node. The alternate id can be used to store correlation id's to link nodes to other data in the event that node id's can't be used due to potentially id collisions.

rawId: string

The raw id for the node. The raw id will generally be the beverage id in the scope of its group.

visible: boolean

is the node visible as calculated by the Pour Engine.

type: string

the type of the node

id: string

unique identifier of the Availability model

Methods

  • Convenience method to update the model with new availability options.

    Parameters

    • options: AvailabilityOptions<any, Record<string, any>>

      the availability options to update the model with.

    Returns void

  • Updates node availability state.

    Parameters

    • available: boolean

      the new availability value to set on the model.

    Returns void