"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeMetadataFilterValue = serializeMetadataFilterValue;
exports.deserializeMetadataFilterValue = deserializeMetadataFilterValue;
const metadataFieldFilterFloatRange_1 = require("./metadataFieldFilterFloatRange");
const metadataFieldFilterFloatRange_2 = require("./metadataFieldFilterFloatRange");
const metadataFieldFilterDateRange_1 = require("./metadataFieldFilterDateRange");
const metadataFieldFilterDateRange_2 = require("./metadataFieldFilterDateRange");
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 serializeMetadataFilterValue(val) {
    if ((0, json_2.sdIsString)(val)) {
        return val;
    }
    if ((0, json_1.sdIsNumber)(val)) {
        return val;
    }
    if ((0, json_3.sdIsList)(val) && val.every(json_2.sdIsString)) {
        return val;
    }
    try {
        if (!(val.lt == void 0) && !(0, json_1.sdIsNumber)(val.lt)) {
            throw new errors_1.BoxSdkError({
                message: 'Expecting number for "lt" of type "MetadataFieldFilterFloatRange"',
            });
        }
        if (!(val.gt == void 0) && !(0, json_1.sdIsNumber)(val.gt)) {
            throw new errors_1.BoxSdkError({
                message: 'Expecting number for "gt" of type "MetadataFieldFilterFloatRange"',
            });
        }
        return (0, metadataFieldFilterFloatRange_1.serializeMetadataFieldFilterFloatRange)(val);
    }
    catch (error) {
        void 0;
    }
    finally {
    }
    try {
        return (0, metadataFieldFilterDateRange_1.serializeMetadataFieldFilterDateRange)(val);
    }
    catch (error) {
        void 0;
    }
    finally {
    }
    throw new errors_1.BoxSdkError({ message: "Can't serialize MetadataFilterValue" });
}
function deserializeMetadataFilterValue(val) {
    if ((0, json_2.sdIsString)(val)) {
        return val;
    }
    if ((0, json_1.sdIsNumber)(val)) {
        return val;
    }
    if ((0, json_3.sdIsList)(val) && val.every(json_2.sdIsString)) {
        return val;
    }
    try {
        return (0, metadataFieldFilterFloatRange_2.deserializeMetadataFieldFilterFloatRange)(val);
    }
    catch (error) {
        void 0;
    }
    finally {
    }
    try {
        return (0, metadataFieldFilterDateRange_2.deserializeMetadataFieldFilterDateRange)(val);
    }
    catch (error) {
        void 0;
    }
    finally {
    }
    throw new errors_1.BoxSdkError({ message: "Can't deserialize MetadataFilterValue" });
}
//# sourceMappingURL=metadataFilterValue.js.map