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