"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeAiAgentAllowedEntity = serializeAiAgentAllowedEntity;
exports.deserializeAiAgentAllowedEntity = deserializeAiAgentAllowedEntity;
const userBase_1 = require("./userBase");
const userBase_2 = require("./userBase");
const groupBase_1 = require("./groupBase");
const groupBase_2 = require("./groupBase");
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
function serializeAiAgentAllowedEntity(val) {
    if (val.type == 'user') {
        return (0, userBase_1.serializeUserBase)(val);
    }
    if (val.type == 'group') {
        return (0, groupBase_1.serializeGroupBase)(val);
    }
    throw new errors_1.BoxSdkError({ message: 'unknown type' });
}
function deserializeAiAgentAllowedEntity(val) {
    if (!(0, json_1.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "AiAgentAllowedEntity"',
        });
    }
    if (val.type == 'user') {
        return (0, userBase_2.deserializeUserBase)(val);
    }
    if (val.type == 'group') {
        return (0, groupBase_2.deserializeGroupBase)(val);
    }
    throw new errors_1.BoxSdkError({ message: "Can't deserialize AiAgentAllowedEntity" });
}
//# sourceMappingURL=aiAgentAllowedEntity.js.map