"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserMiniV2026R0 = void 0;
exports.serializeUserMiniV2026R0 = serializeUserMiniV2026R0;
exports.deserializeUserMiniV2026R0 = deserializeUserMiniV2026R0;
const userBaseV2026R0_1 = require("./userBaseV2026R0.js");
const userBaseV2026R0_2 = require("./userBaseV2026R0.js");
const userBaseV2026R0_3 = require("./userBaseV2026R0.js");
const errors_1 = require("../../box/errors.js");
const json_1 = require("../../serialization/json.js");
const json_2 = require("../../serialization/json.js");
class UserMiniV2026R0 extends userBaseV2026R0_3.UserBaseV2026R0 {
    constructor(fields) {
        super(fields);
        if (fields.name !== undefined) {
            this.name = fields.name;
        }
        if (fields.login !== undefined) {
            this.login = fields.login;
        }
    }
}
exports.UserMiniV2026R0 = UserMiniV2026R0;
function serializeUserMiniV2026R0(val) {
    const base = (0, userBaseV2026R0_2.serializeUserBaseV2026R0)(val);
    if (!(0, json_2.sdIsMap)(base)) {
        throw new errors_1.BoxSdkError({ message: 'Expecting a map for "UserMiniV2026R0"' });
    }
    return Object.assign(Object.assign({}, base), { ['name']: val.name, ['login']: val.login });
}
function deserializeUserMiniV2026R0(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({ message: 'Expecting a map for "UserMiniV2026R0"' });
    }
    if (!(val.name == void 0) && !(0, json_1.sdIsString)(val.name)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "name" of type "UserMiniV2026R0"',
        });
    }
    const name = val.name == void 0 ? void 0 : val.name;
    if (!(val.login == void 0) && !(0, json_1.sdIsString)(val.login)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "login" of type "UserMiniV2026R0"',
        });
    }
    const login = val.login == void 0 ? void 0 : val.login;
    if (val.id == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "id" of type "UserMiniV2026R0" to be defined',
        });
    }
    if (!(0, json_1.sdIsString)(val.id)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "id" of type "UserMiniV2026R0"',
        });
    }
    const id = val.id;
    if (val.type == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "type" of type "UserMiniV2026R0" to be defined',
        });
    }
    const type = (0, userBaseV2026R0_1.deserializeUserBaseV2026R0TypeField)(val.type);
    return {
        name: name,
        login: login,
        id: id,
        type: type,
    };
}
//# sourceMappingURL=userMiniV2026R0.js.map