"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeAiTaxonomyFileReferenceTypeField = serializeAiTaxonomyFileReferenceTypeField;
exports.deserializeAiTaxonomyFileReferenceTypeField = deserializeAiTaxonomyFileReferenceTypeField;
exports.serializeAiTaxonomyFileReference = serializeAiTaxonomyFileReference;
exports.deserializeAiTaxonomyFileReference = deserializeAiTaxonomyFileReference;
const errors_1 = require("../box/errors.js");
const json_1 = require("../serialization/json.js");
const json_2 = require("../serialization/json.js");
function serializeAiTaxonomyFileReferenceTypeField(val) {
    return val;
}
function deserializeAiTaxonomyFileReferenceTypeField(val) {
    if (val == 'file') {
        return val;
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize AiTaxonomyFileReferenceTypeField",
    });
}
function serializeAiTaxonomyFileReference(val) {
    return {
        ['type']: val.type == void 0
            ? val.type
            : serializeAiTaxonomyFileReferenceTypeField(val.type),
        ['taxonomy_key']: val.taxonomyKey,
        ['id']: val.id,
    };
}
function deserializeAiTaxonomyFileReference(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "AiTaxonomyFileReference"',
        });
    }
    const type = val.type == void 0
        ? void 0
        : deserializeAiTaxonomyFileReferenceTypeField(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 "AiTaxonomyFileReference"',
        });
    }
    const taxonomyKey = val.taxonomy_key == void 0 ? void 0 : val.taxonomy_key;
    if (!(val.id == void 0) && !(0, json_1.sdIsString)(val.id)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "id" of type "AiTaxonomyFileReference"',
        });
    }
    const id = val.id == void 0 ? void 0 : val.id;
    return {
        type: type,
        taxonomyKey: taxonomyKey,
        id: id,
    };
}
//# sourceMappingURL=aiTaxonomyFileReference.js.map