"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeEmailAliases = serializeEmailAliases;
exports.deserializeEmailAliases = deserializeEmailAliases;
const emailAlias_1 = require("./emailAlias");
const emailAlias_2 = require("./emailAlias");
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 serializeEmailAliases(val) {
    return {
        ['total_count']: val.totalCount,
        ['entries']: val.entries == void 0
            ? val.entries
            : val.entries.map(function (item) {
                return (0, emailAlias_1.serializeEmailAlias)(item);
            }),
    };
}
function deserializeEmailAliases(val) {
    if (!(0, json_3.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({ message: 'Expecting a map for "EmailAliases"' });
    }
    if (!(val.total_count == void 0) && !(0, json_1.sdIsNumber)(val.total_count)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting number for "total_count" of type "EmailAliases"',
        });
    }
    const totalCount = val.total_count == void 0 ? void 0 : val.total_count;
    if (!(val.entries == void 0) && !(0, json_2.sdIsList)(val.entries)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting array for "entries" of type "EmailAliases"',
        });
    }
    const entries = val.entries == void 0
        ? void 0
        : (0, json_2.sdIsList)(val.entries)
            ? val.entries.map(function (itm) {
                return (0, emailAlias_2.deserializeEmailAlias)(itm);
            })
            : [];
    return { totalCount: totalCount, entries: entries };
}
//# sourceMappingURL=emailAliases.js.map