"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeCollaborationAllowlistEntries = serializeCollaborationAllowlistEntries;
exports.deserializeCollaborationAllowlistEntries = deserializeCollaborationAllowlistEntries;
const collaborationAllowlistEntry_1 = require("./collaborationAllowlistEntry");
const collaborationAllowlistEntry_2 = require("./collaborationAllowlistEntry");
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
const json_2 = require("../serialization/json");
const json_3 = require("../serialization/json");
const json_4 = require("../serialization/json");
function serializeCollaborationAllowlistEntries(val) {
    return {
        ['limit']: val.limit,
        ['next_marker']: val.nextMarker,
        ['prev_marker']: val.prevMarker,
        ['entries']: val.entries == void 0
            ? val.entries
            : val.entries.map(function (item) {
                return (0, collaborationAllowlistEntry_1.serializeCollaborationAllowlistEntry)(item);
            }),
    };
}
function deserializeCollaborationAllowlistEntries(val) {
    if (!(0, json_4.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "CollaborationAllowlistEntries"',
        });
    }
    if (!(val.limit == void 0) && !(0, json_1.sdIsNumber)(val.limit)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting number for "limit" of type "CollaborationAllowlistEntries"',
        });
    }
    const limit = val.limit == void 0 ? void 0 : val.limit;
    if (!(val.next_marker == void 0) && !(0, json_2.sdIsString)(val.next_marker)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "next_marker" of type "CollaborationAllowlistEntries"',
        });
    }
    const nextMarker = val.next_marker == void 0 ? void 0 : val.next_marker;
    if (!(val.prev_marker == void 0) && !(0, json_2.sdIsString)(val.prev_marker)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "prev_marker" of type "CollaborationAllowlistEntries"',
        });
    }
    const prevMarker = val.prev_marker == void 0 ? void 0 : val.prev_marker;
    if (!(val.entries == void 0) && !(0, json_3.sdIsList)(val.entries)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting array for "entries" of type "CollaborationAllowlistEntries"',
        });
    }
    const entries = val.entries == void 0
        ? void 0
        : (0, json_3.sdIsList)(val.entries)
            ? val.entries.map(function (itm) {
                return (0, collaborationAllowlistEntry_2.deserializeCollaborationAllowlistEntry)(itm);
            })
            : [];
    return {
        limit: limit,
        nextMarker: nextMarker,
        prevMarker: prevMarker,
        entries: entries,
    };
}
//# sourceMappingURL=collaborationAllowlistEntries.js.map