import { BoxSdkError } from '../../box/errors.js';
import { sdIsString } from '../../serialization/json.js';
import { sdIsMap } from '../../serialization/json.js';
export class AutomateWorkflowReferenceV2026R0 {
    /**
     * The identifier for the Automate workflow instance. */
    id;
    /**
     * The object type. */
    type = 'workflow';
    /**
     * The display name for the Automate workflow. */
    name;
    rawData;
    constructor(fields) {
        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;
        }
    }
}
export function serializeAutomateWorkflowReferenceV2026R0TypeField(val) {
    return val;
}
export function deserializeAutomateWorkflowReferenceV2026R0TypeField(val) {
    if (val == 'workflow') {
        return val;
    }
    throw new BoxSdkError({
        message: "Can't deserialize AutomateWorkflowReferenceV2026R0TypeField",
    });
}
export function serializeAutomateWorkflowReferenceV2026R0(val) {
    return {
        ['id']: val.id,
        ['type']: serializeAutomateWorkflowReferenceV2026R0TypeField(val.type),
        ['name']: val.name,
    };
}
export function deserializeAutomateWorkflowReferenceV2026R0(val) {
    if (!sdIsMap(val)) {
        throw new BoxSdkError({
            message: 'Expecting a map for "AutomateWorkflowReferenceV2026R0"',
        });
    }
    if (val.id == void 0) {
        throw new BoxSdkError({
            message: 'Expecting "id" of type "AutomateWorkflowReferenceV2026R0" to be defined',
        });
    }
    if (!sdIsString(val.id)) {
        throw new BoxSdkError({
            message: 'Expecting string for "id" of type "AutomateWorkflowReferenceV2026R0"',
        });
    }
    const id = val.id;
    if (val.type == void 0) {
        throw new BoxSdkError({
            message: 'Expecting "type" of type "AutomateWorkflowReferenceV2026R0" to be defined',
        });
    }
    const type = deserializeAutomateWorkflowReferenceV2026R0TypeField(val.type);
    if (!(val.name == void 0) && !sdIsString(val.name)) {
        throw new 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,
    };
}
export function serializeAutomateWorkflowReferenceV2026R0Input(val) {
    return {
        ['id']: val.id,
        ['type']: val.type == void 0
            ? val.type
            : serializeAutomateWorkflowReferenceV2026R0TypeField(val.type),
        ['name']: val.name,
    };
}
export function deserializeAutomateWorkflowReferenceV2026R0Input(val) {
    if (!sdIsMap(val)) {
        throw new BoxSdkError({
            message: 'Expecting a map for "AutomateWorkflowReferenceV2026R0Input"',
        });
    }
    if (val.id == void 0) {
        throw new BoxSdkError({
            message: 'Expecting "id" of type "AutomateWorkflowReferenceV2026R0Input" to be defined',
        });
    }
    if (!sdIsString(val.id)) {
        throw new 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) && !sdIsString(val.name)) {
        throw new 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