"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeRealtimeServers = serializeRealtimeServers;
exports.deserializeRealtimeServers = deserializeRealtimeServers;
const realtimeServer_1 = require("./realtimeServer");
const realtimeServer_2 = require("./realtimeServer");
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
const json_2 = require("../serialization/json");
const json_3 = require("../serialization/json");
function serializeRealtimeServers(val) {
    return {
        ['chunk_size']: val.chunkSize,
        ['entries']: val.entries == void 0
            ? val.entries
            : val.entries.map(function (item) {
                return (0, realtimeServer_1.serializeRealtimeServer)(item);
            }),
    };
}
function deserializeRealtimeServers(val) {
    if (!(0, json_3.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({ message: 'Expecting a map for "RealtimeServers"' });
    }
    if (!(val.chunk_size == void 0) && !(0, json_1.sdIsNumber)(val.chunk_size)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting number for "chunk_size" of type "RealtimeServers"',
        });
    }
    const chunkSize = val.chunk_size == void 0 ? void 0 : val.chunk_size;
    if (!(val.entries == void 0) && !(0, json_2.sdIsList)(val.entries)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting array for "entries" of type "RealtimeServers"',
        });
    }
    const entries = val.entries == void 0
        ? void 0
        : (0, json_2.sdIsList)(val.entries)
            ? val.entries.map(function (itm) {
                return (0, realtimeServer_2.deserializeRealtimeServer)(itm);
            })
            : [];
    return { chunkSize: chunkSize, entries: entries };
}
//# sourceMappingURL=realtimeServers.js.map