"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeOutcome = serializeOutcome;
exports.deserializeOutcome = deserializeOutcome;
const collaboratorVariable_1 = require("./collaboratorVariable");
const collaboratorVariable_2 = require("./collaboratorVariable");
const completionRuleVariable_1 = require("./completionRuleVariable");
const completionRuleVariable_2 = require("./completionRuleVariable");
const roleVariable_1 = require("./roleVariable");
const roleVariable_2 = require("./roleVariable");
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
const json_2 = require("../serialization/json");
function serializeOutcome(val) {
    return {
        ['id']: val.id,
        ['collaborators']: val.collaborators == void 0
            ? val.collaborators
            : (0, collaboratorVariable_1.serializeCollaboratorVariable)(val.collaborators),
        ['completion_rule']: val.completionRule == void 0
            ? val.completionRule
            : (0, completionRuleVariable_1.serializeCompletionRuleVariable)(val.completionRule),
        ['file_collaborator_role']: val.fileCollaboratorRole == void 0
            ? val.fileCollaboratorRole
            : (0, roleVariable_1.serializeRoleVariable)(val.fileCollaboratorRole),
        ['task_collaborators']: val.taskCollaborators == void 0
            ? val.taskCollaborators
            : (0, collaboratorVariable_1.serializeCollaboratorVariable)(val.taskCollaborators),
        ['role']: val.role == void 0 ? val.role : (0, roleVariable_1.serializeRoleVariable)(val.role),
    };
}
function deserializeOutcome(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({ message: 'Expecting a map for "Outcome"' });
    }
    if (val.id == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "id" of type "Outcome" to be defined',
        });
    }
    if (!(0, json_1.sdIsString)(val.id)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "id" of type "Outcome"',
        });
    }
    const id = val.id;
    const collaborators = val.collaborators == void 0
        ? void 0
        : (0, collaboratorVariable_2.deserializeCollaboratorVariable)(val.collaborators);
    const completionRule = val.completion_rule == void 0
        ? void 0
        : (0, completionRuleVariable_2.deserializeCompletionRuleVariable)(val.completion_rule);
    const fileCollaboratorRole = val.file_collaborator_role == void 0
        ? void 0
        : (0, roleVariable_2.deserializeRoleVariable)(val.file_collaborator_role);
    const taskCollaborators = val.task_collaborators == void 0
        ? void 0
        : (0, collaboratorVariable_2.deserializeCollaboratorVariable)(val.task_collaborators);
    const role = val.role == void 0 ? void 0 : (0, roleVariable_2.deserializeRoleVariable)(val.role);
    return {
        id: id,
        collaborators: collaborators,
        completionRule: completionRule,
        fileCollaboratorRole: fileCollaboratorRole,
        taskCollaborators: taskCollaborators,
        role: role,
    };
}
//# sourceMappingURL=outcome.js.map