"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebSocketChannel2023Type = exports.isWebSocket2023Channel = void 0;
const LogUtil_1 = require("../../../logging/LogUtil");
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;
}
exports.isWebSocket2023Channel = isWebSocket2023Channel;
/**
 * 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 {
    constructor(route, features) {
        super(Vocabularies_1.NOTIFY.terms.WebSocketChannel2023, route, features);
        this.logger = (0, LogUtil_1.getLoggerFor)(this);
    }
    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