"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeCollaborationAccessGrantee = serializeCollaborationAccessGrantee;
exports.deserializeCollaborationAccessGrantee = deserializeCollaborationAccessGrantee;
const userCollaborations_1 = require("./userCollaborations");
const userCollaborations_2 = require("./userCollaborations");
const groupMini_1 = require("./groupMini");
const groupMini_2 = require("./groupMini");
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
function serializeCollaborationAccessGrantee(val) {
    if (val.type == 'user') {
        return (0, userCollaborations_1.serializeUserCollaborations)(val);
    }
    if (val.type == 'group') {
        return (0, groupMini_1.serializeGroupMini)(val);
    }
    throw new errors_1.BoxSdkError({ message: 'unknown type' });
}
function deserializeCollaborationAccessGrantee(val) {
    if (!(0, json_1.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "CollaborationAccessGrantee"',
        });
    }
    if (val.type == 'user') {
        return (0, userCollaborations_2.deserializeUserCollaborations)(val);
    }
    if (val.type == 'group') {
        return (0, groupMini_2.deserializeGroupMini)(val);
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize CollaborationAccessGrantee",
    });
}
//# sourceMappingURL=collaborationAccessGrantee.js.map