"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HubDocumentBlocksV2025R0 = void 0;
exports.serializeHubDocumentBlocksV2025R0TypeField = serializeHubDocumentBlocksV2025R0TypeField;
exports.deserializeHubDocumentBlocksV2025R0TypeField = deserializeHubDocumentBlocksV2025R0TypeField;
exports.serializeHubDocumentBlocksV2025R0 = serializeHubDocumentBlocksV2025R0;
exports.deserializeHubDocumentBlocksV2025R0 = deserializeHubDocumentBlocksV2025R0;
exports.serializeHubDocumentBlocksV2025R0Input = serializeHubDocumentBlocksV2025R0Input;
exports.deserializeHubDocumentBlocksV2025R0Input = deserializeHubDocumentBlocksV2025R0Input;
const hubDocumentBlockEntryV2025R0_1 = require("./hubDocumentBlockEntryV2025R0.js");
const hubDocumentBlockEntryV2025R0_2 = require("./hubDocumentBlockEntryV2025R0.js");
const errors_1 = require("../../box/errors.js");
const json_1 = require("../../serialization/json.js");
const json_2 = require("../../serialization/json.js");
const json_3 = require("../../serialization/json.js");
const json_4 = require("../../serialization/json.js");
class HubDocumentBlocksV2025R0 {
    constructor(fields) {
        /**
         * The value will always be `document_blocks`. */
        this.type = 'document_blocks';
        if (fields.entries !== undefined) {
            this.entries = fields.entries;
        }
        if (fields.type !== undefined) {
            this.type = fields.type;
        }
        if (fields.limit !== undefined) {
            this.limit = fields.limit;
        }
        if (fields.nextMarker !== undefined) {
            this.nextMarker = fields.nextMarker;
        }
        if (fields.rawData !== undefined) {
            this.rawData = fields.rawData;
        }
    }
}
exports.HubDocumentBlocksV2025R0 = HubDocumentBlocksV2025R0;
function serializeHubDocumentBlocksV2025R0TypeField(val) {
    return val;
}
function deserializeHubDocumentBlocksV2025R0TypeField(val) {
    if (val == 'document_blocks') {
        return val;
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize HubDocumentBlocksV2025R0TypeField",
    });
}
function serializeHubDocumentBlocksV2025R0(val) {
    return {
        ['entries']: val.entries.map(function (item) {
            return (0, hubDocumentBlockEntryV2025R0_1.serializeHubDocumentBlockEntryV2025R0)(item);
        }),
        ['type']: serializeHubDocumentBlocksV2025R0TypeField(val.type),
        ['limit']: val.limit,
        ['next_marker']: val.nextMarker,
    };
}
function deserializeHubDocumentBlocksV2025R0(val) {
    if (!(0, json_4.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "HubDocumentBlocksV2025R0"',
        });
    }
    if (val.entries == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "entries" of type "HubDocumentBlocksV2025R0" to be defined',
        });
    }
    if (!(0, json_3.sdIsList)(val.entries)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting array for "entries" of type "HubDocumentBlocksV2025R0"',
        });
    }
    const entries = (0, json_3.sdIsList)(val.entries)
        ? val.entries.map(function (itm) {
            return (0, hubDocumentBlockEntryV2025R0_2.deserializeHubDocumentBlockEntryV2025R0)(itm);
        })
        : [];
    if (val.type == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "type" of type "HubDocumentBlocksV2025R0" to be defined',
        });
    }
    const type = deserializeHubDocumentBlocksV2025R0TypeField(val.type);
    if (!(val.limit == void 0) && !(0, json_1.sdIsNumber)(val.limit)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting number for "limit" of type "HubDocumentBlocksV2025R0"',
        });
    }
    const limit = val.limit == void 0 ? void 0 : val.limit;
    if (!(val.next_marker == void 0) && !(0, json_2.sdIsString)(val.next_marker)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "next_marker" of type "HubDocumentBlocksV2025R0"',
        });
    }
    const nextMarker = val.next_marker == void 0 ? void 0 : val.next_marker;
    return {
        entries: entries,
        type: type,
        limit: limit,
        nextMarker: nextMarker,
    };
}
function serializeHubDocumentBlocksV2025R0Input(val) {
    return {
        ['entries']: val.entries.map(function (item) {
            return (0, hubDocumentBlockEntryV2025R0_1.serializeHubDocumentBlockEntryV2025R0)(item);
        }),
        ['type']: val.type == void 0
            ? val.type
            : serializeHubDocumentBlocksV2025R0TypeField(val.type),
        ['limit']: val.limit,
        ['next_marker']: val.nextMarker,
    };
}
function deserializeHubDocumentBlocksV2025R0Input(val) {
    if (!(0, json_4.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "HubDocumentBlocksV2025R0Input"',
        });
    }
    if (val.entries == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "entries" of type "HubDocumentBlocksV2025R0Input" to be defined',
        });
    }
    if (!(0, json_3.sdIsList)(val.entries)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting array for "entries" of type "HubDocumentBlocksV2025R0Input"',
        });
    }
    const entries = (0, json_3.sdIsList)(val.entries)
        ? val.entries.map(function (itm) {
            return (0, hubDocumentBlockEntryV2025R0_2.deserializeHubDocumentBlockEntryV2025R0)(itm);
        })
        : [];
    const type = val.type == void 0
        ? void 0
        : deserializeHubDocumentBlocksV2025R0TypeField(val.type);
    if (!(val.limit == void 0) && !(0, json_1.sdIsNumber)(val.limit)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting number for "limit" of type "HubDocumentBlocksV2025R0Input"',
        });
    }
    const limit = val.limit == void 0 ? void 0 : val.limit;
    if (!(val.next_marker == void 0) && !(0, json_2.sdIsString)(val.next_marker)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "next_marker" of type "HubDocumentBlocksV2025R0Input"',
        });
    }
    const nextMarker = val.next_marker == void 0 ? void 0 : val.next_marker;
    return {
        entries: entries,
        type: type,
        limit: limit,
        nextMarker: nextMarker,
    };
}
//# sourceMappingURL=hubDocumentBlocksV2025R0.js.map