typings/lib2/messagev2/messagePayload/formMessage.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FormMessage = void 0;
const internal_1 = require("../internal");
/**
 * Represents a form message.
 * @extends NonRawMessage
 */
class FormMessage extends internal_1.NonRawMessage {
    /**
     * Creates an instance of the FormMessage class.
     * @param {ReadOnlyForm[]} forms The list of forms in the message.
     */
    constructor(forms) {
        super();
        this.type = 'form';
        this.forms = [];
        this.formColumns = 1;
        if (forms) {
            this.forms = forms;
        }
    }
    /**
     * Deserialize nested object properties into corresponding class instances
     */
    deserializeNestedProperties() {
        super.deserializeNestedProperties();
        if (this.forms) {
            this.forms = internal_1.MessageUtil.deserializeReadOnlyForms(this.forms);
        }
        if (this.paginationInfo) {
            this.paginationInfo = internal_1.MessageUtil.deserializePaginationInfo(this.paginationInfo);
        }
    }
    /**
     * Gets the list of forms in the message.
     * @returns {ReadOnlyForm[]} The list of forms in the message.
     */
    getForms() {
        return this.forms;
    }
    /**
     * Sets the forms in the form message.
     * @param {ReadOnlyForm[]} forms The list of forms in the message.
     * @returns {FormMessage} The updated instance of the FormMessage.
     */
    setForms(forms) {
        this.forms = forms;
        return this;
    }
    /**
     * Adds a form to the message.
     * @param {ReadOnlyForm} form The form to add.
     * @returns {FormMessage} The updated instance of the FormMessage.
     */
    addForm(form) {
        this.forms.push(form);
        return this;
    }
    /**
     * Gets the number of form columns.
     * @returns {number} The number of form columns.
     */
    getFormColumns() {
        return this.formColumns;
    }
    /**
     * Sets the number of form columns.
     * @param {number} formColumns The number of form columns to set.
     * @returns {FormMessage} The updated instance of the FormMessage.
     */
    setFormColumns(formColumns) {
        this.formColumns = formColumns;
        return this;
    }
    /**
     * Gets the pagination information.
     * @returns {PaginationInfo | undefined} The pagination information.
     */
    getPaginationInfo() {
        return this.paginationInfo;
    }
    /**
     * Sets the pagination information.
     * @param {PaginationInfo} paginationInfo The pagination information to set.
     * @returns {FormMessage} The updated instance of the FormMessage.
     */
    setPaginationInfo(paginationInfo) {
        this.paginationInfo = paginationInfo;
        return this;
    }
}
exports.FormMessage = FormMessage;