"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AutomateWorkflowReferenceV2026R0 = void 0;
exports.serializeAutomateWorkflowReferenceV2026R0TypeField = serializeAutomateWorkflowReferenceV2026R0TypeField;
exports.deserializeAutomateWorkflowReferenceV2026R0TypeField = deserializeAutomateWorkflowReferenceV2026R0TypeField;
exports.serializeAutomateWorkflowReferenceV2026R0 = serializeAutomateWorkflowReferenceV2026R0;
exports.deserializeAutomateWorkflowReferenceV2026R0 = deserializeAutomateWorkflowReferenceV2026R0;
exports.serializeAutomateWorkflowReferenceV2026R0Input = serializeAutomateWorkflowReferenceV2026R0Input;
exports.deserializeAutomateWorkflowReferenceV2026R0Input = deserializeAutomateWorkflowReferenceV2026R0Input;
const errors_1 = require("../../box/errors.js");
const json_1 = require("../../serialization/json.js");
const json_2 = require("../../serialization/json.js");
class AutomateWorkflowReferenceV2026R0 {
    constructor(fields) {
        /**
         * The object type. */
        this.type = 'workflow';
        if (fields.id !== undefined) {
            this.id = fields.id;
        }
        if (fields.type !== undefined) {
            this.type = fields.type;
        }
        if (fields.name !== undefined) {
            this.name = fields.name;
        }
        if (fields.rawData !== undefined) {
            this.rawData = fields.rawData;
        }
    }
}
exports.AutomateWorkflowReferenceV2026R0 = AutomateWorkflowReferenceV2026R0;
function serializeAutomateWorkflowReferenceV2026R0TypeField(val) {
    return val;
}
function deserializeAutomateWorkflowReferenceV2026R0TypeField(val) {
    if (val == 'workflow') {
        return val;
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize AutomateWorkflowReferenceV2026R0TypeField",
    });
}
function serializeAutomateWorkflowReferenceV2026R0(val) {
    return {
        ['id']: val.id,
        ['type']: serializeAutomateWorkflowReferenceV2026R0TypeField(val.type),
        ['name']: val.name,
    };
}
function deserializeAutomateWorkflowReferenceV2026R0(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "AutomateWorkflowReferenceV2026R0"',
        });
    }
    if (val.id == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "id" of type "AutomateWorkflowReferenceV2026R0" to be defined',
        });
    }
    if (!(0, json_1.sdIsString)(val.id)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "id" of type "AutomateWorkflowReferenceV2026R0"',
        });
    }
    const id = val.id;
    if (val.type == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "type" of type "AutomateWorkflowReferenceV2026R0" to be defined',
        });
    }
    const type = deserializeAutomateWorkflowReferenceV2026R0TypeField(val.type);
    if (!(val.name == void 0) && !(0, json_1.sdIsString)(val.name)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "name" of type "AutomateWorkflowReferenceV2026R0"',
        });
    }
    const name = val.name == void 0 ? void 0 : val.name;
    return {
        id: id,
        type: type,
        name: name,
    };
}
function serializeAutomateWorkflowReferenceV2026R0Input(val) {
    return {
        ['id']: val.id,
        ['type']: val.type == void 0
            ? val.type
            : serializeAutomateWorkflowReferenceV2026R0TypeField(val.type),
        ['name']: val.name,
    };
}
function deserializeAutomateWorkflowReferenceV2026R0Input(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "AutomateWorkflowReferenceV2026R0Input"',
        });
    }
    if (val.id == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "id" of type "AutomateWorkflowReferenceV2026R0Input" to be defined',
        });
    }
    if (!(0, json_1.sdIsString)(val.id)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "id" of type "AutomateWorkflowReferenceV2026R0Input"',
        });
    }
    const id = val.id;
    const type = val.type == void 0
        ? void 0
        : deserializeAutomateWorkflowReferenceV2026R0TypeField(val.type);
    if (!(val.name == void 0) && !(0, json_1.sdIsString)(val.name)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "name" of type "AutomateWorkflowReferenceV2026R0Input"',
        });
    }
    const name = val.name == void 0 ? void 0 : val.name;
    return {
        id: id,
        type: type,
        name: name,
    };
}
//# sourceMappingURL=automateWorkflowReferenceV2026R0.js.map