"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeAiExtractAgent = serializeAiExtractAgent;
exports.deserializeAiExtractAgent = deserializeAiExtractAgent;
const aiAgentReference_1 = require("./aiAgentReference");
const aiAgentReference_2 = require("./aiAgentReference");
const aiAgentExtract_1 = require("./aiAgentExtract");
const aiAgentExtract_2 = require("./aiAgentExtract");
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
function serializeAiExtractAgent(val) {
    if (val.type == 'ai_agent_id') {
        return (0, aiAgentReference_1.serializeAiAgentReference)(val);
    }
    if (val.type == 'ai_agent_extract') {
        return (0, aiAgentExtract_1.serializeAiAgentExtract)(val);
    }
    throw new errors_1.BoxSdkError({ message: 'unknown type' });
}
function deserializeAiExtractAgent(val) {
    if (!(0, json_1.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({ message: 'Expecting a map for "AiExtractAgent"' });
    }
    if (val.type == 'ai_agent_id') {
        return (0, aiAgentReference_2.deserializeAiAgentReference)(val);
    }
    if (val.type == 'ai_agent_extract') {
        return (0, aiAgentExtract_2.deserializeAiAgentExtract)(val);
    }
    throw new errors_1.BoxSdkError({ message: "Can't deserialize AiExtractAgent" });
}
//# sourceMappingURL=aiExtractAgent.js.map