"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PlaybackController = void 0; const schema_js_1 = require("../schema.js"); const types_js_1 = require("../types.js"); // In the order of the discovery example const OPERATIONS = ["Play", "Pause", "Stop", "Next", "Previous", "FastForward", "Rewind", "StartOver"]; // Alexa sends the operations the capability lists const operation = (name) => ({ name, payload: schema_js_1.s.object({}), when: ({ options }) => (options.supportedOperations ?? OPERATIONS).includes(name), }); /** * Play, pause and the other buttons of a player. The interface reports nothing: what plays is the playbackState of * Alexa.PlaybackStateReporter, which a Response to these directives has in its context. Errors of a video device go * under Alexa.Video, the others under Alexa. */ exports.PlaybackController = (0, types_js_1.defineInterface)({ namespace: "Alexa.PlaybackController", version: "3", doc: "https://developer.amazon.com/docs/alexaplus/device-apis/alexa-playbackcontroller.html", kind: "controller", tier: 2, instanced: false, properties: {}, directives: { Play: operation("Play"), Pause: operation("Pause"), Stop: operation("Stop"), Next: operation("Next"), Previous: operation("Previous"), FastForward: operation("FastForward"), Rewind: operation("Rewind"), StartOver: operation("StartOver"), }, options: schema_js_1.s.object({ /** Default: all eight. */ supportedOperations: schema_js_1.s.optional(schema_js_1.s.array(schema_js_1.s.enum(...OPERATIONS), { min: 1 })), }, { unknownKeys: "reject" }), // The example has a properties object without fields, which topLevel puts where properties: false left none discovery: ({ options: { supportedOperations = [...OPERATIONS] } }) => ({ properties: false, topLevel: { properties: {}, supportedOperations }, }), });