"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.happened = exports.timestamp = void 0; // What the events of several interfaces have in common. const catalog_js_1 = require("./catalog.js"); const schema_js_1 = require("./schema.js"); /** The time of an event: now, unless the payload says when. */ exports.timestamp = schema_js_1.s.defaulted(schema_js_1.s.dateTime(), () => new Date().toISOString()); /** * The payload of an event that happened at a time and for a reason: ActivationStarted, DoorbellPress. Both are * required by Alexa. The cause is the usual one of the event unless the payload names another. */ const happened = (usually) => schema_js_1.s.object({ cause: schema_js_1.s.defaulted(schema_js_1.s.object({ type: schema_js_1.s.enum(...catalog_js_1.CAUSES) }), () => ({ type: usually })), timestamp: exports.timestamp, }); exports.happened = happened;