"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeSearchResultWithSharedLinkItem = serializeSearchResultWithSharedLinkItem;
exports.deserializeSearchResultWithSharedLinkItem = deserializeSearchResultWithSharedLinkItem;
const fileFull_1 = require("./fileFull");
const fileFull_2 = require("./fileFull");
const folderFull_1 = require("./folderFull");
const folderFull_2 = require("./folderFull");
const webLink_1 = require("./webLink");
const webLink_2 = require("./webLink");
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
function serializeSearchResultWithSharedLinkItem(val) {
    if (val.type == 'file') {
        return (0, fileFull_1.serializeFileFull)(val);
    }
    if (val.type == 'folder') {
        return (0, folderFull_1.serializeFolderFull)(val);
    }
    if (val.type == 'web_link') {
        return (0, webLink_1.serializeWebLink)(val);
    }
    throw new errors_1.BoxSdkError({ message: 'unknown type' });
}
function deserializeSearchResultWithSharedLinkItem(val) {
    if (!(0, json_1.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "SearchResultWithSharedLinkItem"',
        });
    }
    if (val.type == 'file') {
        return (0, fileFull_2.deserializeFileFull)(val);
    }
    if (val.type == 'folder') {
        return (0, folderFull_2.deserializeFolderFull)(val);
    }
    if (val.type == 'web_link') {
        return (0, webLink_2.deserializeWebLink)(val);
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize SearchResultWithSharedLinkItem",
    });
}
//# sourceMappingURL=searchResultWithSharedLinkItem.js.map