"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeMetadataTaxonomyAncestor = serializeMetadataTaxonomyAncestor;
exports.deserializeMetadataTaxonomyAncestor = deserializeMetadataTaxonomyAncestor;
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 serializeMetadataTaxonomyAncestor(val) {
    return {
        ['id']: val.id,
        ['displayName']: val.displayName,
        ['level']: val.level,
    };
}
function deserializeMetadataTaxonomyAncestor(val) {
    if (!(0, json_3.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "MetadataTaxonomyAncestor"',
        });
    }
    if (!(val.id == void 0) && !(0, json_2.sdIsString)(val.id)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "id" of type "MetadataTaxonomyAncestor"',
        });
    }
    const id = val.id == void 0 ? void 0 : val.id;
    if (!(val.displayName == void 0) && !(0, json_2.sdIsString)(val.displayName)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "displayName" of type "MetadataTaxonomyAncestor"',
        });
    }
    const displayName = val.displayName == void 0 ? void 0 : val.displayName;
    if (!(val.level == void 0) && !(0, json_1.sdIsNumber)(val.level)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting number for "level" of type "MetadataTaxonomyAncestor"',
        });
    }
    const level = val.level == void 0 ? void 0 : val.level;
    return {
        id: id,
        displayName: displayName,
        level: level,
    };
}
//# sourceMappingURL=metadataTaxonomyAncestor.js.map