"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebSocketChannel2023Type = void 0;
exports.isWebSocket2023Channel = isWebSocket2023Channel;
const global_logger_factory_1 = require("global-logger-factory");
const Vocabularies_1 = require("../../../util/Vocabularies");
const BaseChannelType_1 = require("../BaseChannelType");
const WebSocket2023Util_1 = require("./WebSocket2023Util");
function isWebSocket2023Channel(channel) {
    return channel.type === Vocabularies_1.NOTIFY.WebSocketChannel2023;
}
/**
 * The notification channel type WebSocketChannel2023 as described in
 * https://solid.github.io/notifications/websocket-channel-2023
 *
 * Requires read permissions on a resource to be able to receive notifications.
 */
class WebSocketChannel2023Type extends BaseChannelType_1.BaseChannelType {
    logger = (0, global_logger_factory_1.getLoggerFor)(this);
    constructor(route, features) {
        super(Vocabularies_1.NOTIFY.terms.WebSocketChannel2023, route, features);
    }
    async initChannel(data, credentials) {
        const channel = await super.initChannel(data, credentials);
        return {
            ...channel,
            type: Vocabularies_1.NOTIFY.WebSocketChannel2023,
            receiveFrom: (0, WebSocket2023Util_1.generateWebSocketUrl)(channel.id),
        };
    }
}
exports.WebSocketChannel2023Type = WebSocketChannel2023Type;
//# sourceMappingURL=WebSocketChannel2023Type.js.map