"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserReferenceV2025R0 = void 0;
exports.serializeUserReferenceV2025R0TypeField = serializeUserReferenceV2025R0TypeField;
exports.deserializeUserReferenceV2025R0TypeField = deserializeUserReferenceV2025R0TypeField;
exports.serializeUserReferenceV2025R0 = serializeUserReferenceV2025R0;
exports.deserializeUserReferenceV2025R0 = deserializeUserReferenceV2025R0;
exports.serializeUserReferenceV2025R0Input = serializeUserReferenceV2025R0Input;
exports.deserializeUserReferenceV2025R0Input = deserializeUserReferenceV2025R0Input;
const errors_1 = require("../../box/errors");
const json_1 = require("../../serialization/json");
const json_2 = require("../../serialization/json");
class UserReferenceV2025R0 {
    /**
     * The value is always `user`. */
    type = 'user';
    /**
     * The unique identifier for the user. */
    id;
    rawData;
    constructor(fields) {
        if (fields.type !== undefined) {
            this.type = fields.type;
        }
        if (fields.id !== undefined) {
            this.id = fields.id;
        }
        if (fields.rawData !== undefined) {
            this.rawData = fields.rawData;
        }
    }
}
exports.UserReferenceV2025R0 = UserReferenceV2025R0;
function serializeUserReferenceV2025R0TypeField(val) {
    return val;
}
function deserializeUserReferenceV2025R0TypeField(val) {
    if (val == 'user') {
        return val;
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize UserReferenceV2025R0TypeField",
    });
}
function serializeUserReferenceV2025R0(val) {
    return {
        ['type']: serializeUserReferenceV2025R0TypeField(val.type),
        ['id']: val.id,
    };
}
function deserializeUserReferenceV2025R0(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "UserReferenceV2025R0"',
        });
    }
    if (val.type == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "type" of type "UserReferenceV2025R0" to be defined',
        });
    }
    const type = deserializeUserReferenceV2025R0TypeField(val.type);
    if (val.id == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "id" of type "UserReferenceV2025R0" to be defined',
        });
    }
    if (!(0, json_1.sdIsString)(val.id)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "id" of type "UserReferenceV2025R0"',
        });
    }
    const id = val.id;
    return { type: type, id: id };
}
function serializeUserReferenceV2025R0Input(val) {
    return {
        ['type']: val.type == void 0
            ? val.type
            : serializeUserReferenceV2025R0TypeField(val.type),
        ['id']: val.id,
    };
}
function deserializeUserReferenceV2025R0Input(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "UserReferenceV2025R0Input"',
        });
    }
    const type = val.type == void 0
        ? void 0
        : deserializeUserReferenceV2025R0TypeField(val.type);
    if (val.id == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "id" of type "UserReferenceV2025R0Input" to be defined',
        });
    }
    if (!(0, json_1.sdIsString)(val.id)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "id" of type "UserReferenceV2025R0Input"',
        });
    }
    const id = val.id;
    return { type: type, id: id };
}
//# sourceMappingURL=userReferenceV2025R0.js.map