"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeAppItemAssociatedItem = serializeAppItemAssociatedItem;
exports.deserializeAppItemAssociatedItem = deserializeAppItemAssociatedItem;
const fileBase_1 = require("./fileBase");
const fileBase_2 = require("./fileBase");
const folderBase_1 = require("./folderBase");
const folderBase_2 = require("./folderBase");
const webLinkBase_1 = require("./webLinkBase");
const webLinkBase_2 = require("./webLinkBase");
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
function serializeAppItemAssociatedItem(val) {
    if (val.type == 'file') {
        return (0, fileBase_1.serializeFileBase)(val);
    }
    if (val.type == 'folder') {
        return (0, folderBase_1.serializeFolderBase)(val);
    }
    if (val.type == 'web_link') {
        return (0, webLinkBase_1.serializeWebLinkBase)(val);
    }
    throw new errors_1.BoxSdkError({ message: 'unknown type' });
}
function deserializeAppItemAssociatedItem(val) {
    if (!(0, json_1.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "AppItemAssociatedItem"',
        });
    }
    if (val.type == 'file') {
        return (0, fileBase_2.deserializeFileBase)(val);
    }
    if (val.type == 'folder') {
        return (0, folderBase_2.deserializeFolderBase)(val);
    }
    if (val.type == 'web_link') {
        return (0, webLinkBase_2.deserializeWebLinkBase)(val);
    }
    throw new errors_1.BoxSdkError({ message: "Can't deserialize AppItemAssociatedItem" });
}
//# sourceMappingURL=appItemAssociatedItem.js.map