"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeSearchResultsResponse = serializeSearchResultsResponse;
exports.deserializeSearchResultsResponse = deserializeSearchResultsResponse;
const searchResults_1 = require("./searchResults");
const searchResults_2 = require("./searchResults");
const searchResultsWithSharedLinks_1 = require("./searchResultsWithSharedLinks");
const searchResultsWithSharedLinks_2 = require("./searchResultsWithSharedLinks");
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
function serializeSearchResultsResponse(val) {
    if (val.type == 'search_results_items') {
        return (0, searchResults_1.serializeSearchResults)(val);
    }
    if (val.type == 'search_results_with_shared_links') {
        return (0, searchResultsWithSharedLinks_1.serializeSearchResultsWithSharedLinks)(val);
    }
    throw new errors_1.BoxSdkError({ message: 'unknown type' });
}
function deserializeSearchResultsResponse(val) {
    if (!(0, json_1.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "SearchResultsResponse"',
        });
    }
    if (val.type == 'search_results_items') {
        return (0, searchResults_2.deserializeSearchResults)(val);
    }
    if (val.type == 'search_results_with_shared_links') {
        return (0, searchResultsWithSharedLinks_2.deserializeSearchResultsWithSharedLinks)(val);
    }
    throw new errors_1.BoxSdkError({ message: "Can't deserialize SearchResultsResponse" });
}
//# sourceMappingURL=searchResultsResponse.js.map