"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HubParagraphTextBlockV2025R0 = void 0;
exports.serializeHubParagraphTextBlockV2025R0TypeField = serializeHubParagraphTextBlockV2025R0TypeField;
exports.deserializeHubParagraphTextBlockV2025R0TypeField = deserializeHubParagraphTextBlockV2025R0TypeField;
exports.serializeHubParagraphTextBlockV2025R0 = serializeHubParagraphTextBlockV2025R0;
exports.deserializeHubParagraphTextBlockV2025R0 = deserializeHubParagraphTextBlockV2025R0;
const hubDocumentBlockV2025R0_1 = require("./hubDocumentBlockV2025R0.js");
const errors_1 = require("../../box/errors.js");
const json_1 = require("../../serialization/json.js");
const json_2 = require("../../serialization/json.js");
class HubParagraphTextBlockV2025R0 {
    constructor(fields) {
        /**
         * The type of this block. The value is always `paragraph`. */
        this.type = 'paragraph';
        if (fields.id !== undefined) {
            this.id = fields.id;
        }
        if (fields.parentId !== undefined) {
            this.parentId = fields.parentId;
        }
        if (fields.rawData !== undefined) {
            this.rawData = fields.rawData;
        }
        if (fields.type !== undefined) {
            this.type = fields.type;
        }
        if (fields.fragment !== undefined) {
            this.fragment = fields.fragment;
        }
    }
}
exports.HubParagraphTextBlockV2025R0 = HubParagraphTextBlockV2025R0;
function serializeHubParagraphTextBlockV2025R0TypeField(val) {
    return val;
}
function deserializeHubParagraphTextBlockV2025R0TypeField(val) {
    if (val == 'paragraph') {
        return val;
    }
    throw new errors_1.BoxSdkError({
        message: "Can't deserialize HubParagraphTextBlockV2025R0TypeField",
    });
}
function serializeHubParagraphTextBlockV2025R0(val) {
    const base = (0, hubDocumentBlockV2025R0_1.serializeHubDocumentBlockV2025R0)(val);
    if (!(0, json_2.sdIsMap)(base)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "HubParagraphTextBlockV2025R0"',
        });
    }
    return Object.assign(Object.assign({}, base), {
        ['type']: serializeHubParagraphTextBlockV2025R0TypeField(val.type),
        ['fragment']: val.fragment,
    });
}
function deserializeHubParagraphTextBlockV2025R0(val) {
    if (!(0, json_2.sdIsMap)(val)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting a map for "HubParagraphTextBlockV2025R0"',
        });
    }
    if (val.type == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "type" of type "HubParagraphTextBlockV2025R0" to be defined',
        });
    }
    const type = deserializeHubParagraphTextBlockV2025R0TypeField(val.type);
    if (val.fragment == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "fragment" of type "HubParagraphTextBlockV2025R0" to be defined',
        });
    }
    if (!(0, json_1.sdIsString)(val.fragment)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "fragment" of type "HubParagraphTextBlockV2025R0"',
        });
    }
    const fragment = val.fragment;
    if (val.id == void 0) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting "id" of type "HubParagraphTextBlockV2025R0" to be defined',
        });
    }
    if (!(0, json_1.sdIsString)(val.id)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "id" of type "HubParagraphTextBlockV2025R0"',
        });
    }
    const id = val.id;
    if (!(val.parent_id == void 0) && !(0, json_1.sdIsString)(val.parent_id)) {
        throw new errors_1.BoxSdkError({
            message: 'Expecting string for "parent_id" of type "HubParagraphTextBlockV2025R0"',
        });
    }
    const parentId = val.parent_id == void 0 ? void 0 : val.parent_id;
    return {
        type: type,
        fragment: fragment,
        id: id,
        parentId: parentId,
    };
}
//# sourceMappingURL=hubParagraphTextBlockV2025R0.js.map