"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GroupKeyResponse = void 0;
const EncryptedGroupKey_1 = require("./EncryptedGroupKey");
const StreamMessage_1 = require("./StreamMessage");
const ValidationError_1 = require("./ValidationError");
class GroupKeyResponse {
    requestId;
    recipient;
    encryptedGroupKeys;
    constructor({ requestId, recipient, encryptedGroupKeys }) {
        this.requestId = requestId;
        this.recipient = recipient;
        this.encryptedGroupKeys = encryptedGroupKeys;
        // Validate content of encryptedGroupKeys
        this.encryptedGroupKeys.forEach((it) => {
            if (!(it instanceof EncryptedGroupKey_1.EncryptedGroupKey)) {
                throw new ValidationError_1.ValidationError(
                // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
                `Expected 'encryptedGroupKeys' to be a list of EncryptedGroupKey instances! Was: ${this.encryptedGroupKeys}`);
            }
        });
    }
    static is(streamMessage) {
        return streamMessage.messageType === StreamMessage_1.StreamMessageType.GROUP_KEY_RESPONSE;
    }
}
exports.GroupKeyResponse = GroupKeyResponse;
//# sourceMappingURL=GroupKeyResponse.js.map