"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeSearchResultWithSharedLink = serializeSearchResultWithSharedLink;
exports.deserializeSearchResultWithSharedLink = deserializeSearchResultWithSharedLink;
const searchResultWithSharedLinkItem_1 = require("./searchResultWithSharedLinkItem");
const searchResultWithSharedLinkItem_2 = require("./searchResultWithSharedLinkItem");
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
const json_2 = require("../serialization/json");
function serializeSearchResultWithSharedLink(val) {
    return {
        ['accessible_via_shared_link']: val.accessibleViaSharedLink,
        ['item']: val.item == void 0
            ? val.item
            : (0, searchResultWithSharedLinkItem_1.serializeSearchResultWithSharedLinkItem)(val.item),
        ['type']: val.type,
    };
}
function deserializeSearchResultWithSharedLink(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "SearchResultWithSharedLink"',
        });
    }
    if (!(val.accessible_via_shared_link == void 0) &&
        !(0, json_1.sdIsString)(val.accessible_via_shared_link)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "accessible_via_shared_link" of type "SearchResultWithSharedLink"',
        });
    }
    const accessibleViaSharedLink = val.accessible_via_shared_link == void 0
        ? void 0
        : val.accessible_via_shared_link;
    const item = val.item == void 0
        ? void 0
        : (0, searchResultWithSharedLinkItem_2.deserializeSearchResultWithSharedLinkItem)(val.item);
    if (!(val.type == void 0) && !(0, json_1.sdIsString)(val.type)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "type" of type "SearchResultWithSharedLink"',
        });
    }
    const type = val.type == void 0 ? void 0 : val.type;
    return {
        accessibleViaSharedLink: accessibleViaSharedLink,
        item: item,
        type: type,
    };
}
//# sourceMappingURL=searchResultWithSharedLink.js.map