"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeAiTaxonomyReferenceTypeField = serializeAiTaxonomyReferenceTypeField;
exports.deserializeAiTaxonomyReferenceTypeField = deserializeAiTaxonomyReferenceTypeField;
exports.serializeAiTaxonomyReference = serializeAiTaxonomyReference;
exports.deserializeAiTaxonomyReference = deserializeAiTaxonomyReference;
const errors_1 = require("../box/errors.js");
const json_1 = require("../serialization/json.js");
const json_2 = require("../serialization/json.js");
function serializeAiTaxonomyReferenceTypeField(val) {
    return val;
}
function deserializeAiTaxonomyReferenceTypeField(val) {
    if (val == 'taxonomy') {
        return val;
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize AiTaxonomyReferenceTypeField",
    });
}
function serializeAiTaxonomyReference(val) {
    return {
        ['type']: val.type == void 0
            ? val.type
            : serializeAiTaxonomyReferenceTypeField(val.type),
        ['taxonomy_key']: val.taxonomyKey,
        ['namespace']: val.namespace,
    };
}
function deserializeAiTaxonomyReference(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "AiTaxonomyReference"',
        });
    }
    const type = val.type == void 0
        ? void 0
        : deserializeAiTaxonomyReferenceTypeField(val.type);
    if (!(val.taxonomy_key == void 0) && !(0, json_1.sdIsString)(val.taxonomy_key)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "taxonomy_key" of type "AiTaxonomyReference"',
        });
    }
    const taxonomyKey = val.taxonomy_key == void 0 ? void 0 : val.taxonomy_key;
    if (!(val.namespace == void 0) && !(0, json_1.sdIsString)(val.namespace)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "namespace" of type "AiTaxonomyReference"',
        });
    }
    const namespace = val.namespace == void 0 ? void 0 : val.namespace;
    return {
        type: type,
        taxonomyKey: taxonomyKey,
        namespace: namespace,
    };
}
//# sourceMappingURL=aiTaxonomyReference.js.map