typings/lib2/messagev2/messagePayload/tableFormMessage.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TableFormMessage = void 0;
const internal_1 = require("../internal");
/**
 * Represents a table form message.
 * @extends NonRawMessage
 */
class TableFormMessage extends internal_1.NonRawMessage {
    /**
     * Creates an instance of TableFormMessage.
     * @param {TableHeading[]} headings The table headings.
     * @param {Row[]} rows The table rows.
     * @param {ReadOnlyForm[]} forms The read-only forms.
     */
    constructor(headings, rows, forms) {
        super();
        this.type = 'tableForm';
        this.headings = [];
        this.rows = [];
        this.forms = [];
        this.formColumns = 1;
        if (headings) {
            this.headings = headings;
        }
        if (rows) {
            this.rows = rows;
        }
        if (forms) {
            this.forms = forms;
        }
    }
    /**
     * Deserialize nested object properties into corresponding class instances
     */
    deserializeNestedProperties() {
        super.deserializeNestedProperties();
        if (this.headings) {
            this.headings = internal_1.MessageUtil.deserializeTableHeadings(this.headings);
        }
        if (this.rows) {
            this.rows = internal_1.MessageUtil.deserializeRows(this.rows);
        }
        if (this.forms) {
            this.forms = internal_1.MessageUtil.deserializeReadOnlyForms(this.forms);
        }
        if (this.paginationInfo) {
            this.paginationInfo = internal_1.MessageUtil.deserializePaginationInfo(this.paginationInfo);
        }
    }
    /**
     * Gets the table headings.
     * @returns {TableHeading[]} The table headings.
     */
    getHeadings() {
        return this.headings;
    }
    /**
     * Sets the table headings.
     * @param {TableHeading[]} headings The table headings.
     * @returns {this} The current instance of TableFormMessage.
     */
    setHeadings(headings) {
        this.headings = headings;
        return this;
    }
    /**
     * Adds a heading to the table.
     * @param {TableHeading} heading The heading to add.
     * @returns {this} The current instance of TableFormMessage.
     */
    addHeading(heading) {
        this.headings.push(heading);
        return this;
    }
    /**
     * Gets the table rows.
     * @returns {Row[]} The table rows.
     */
    getRows() {
        return this.rows;
    }
    /**
     * Sets the table rows.
     * @param {Row[]} rows The table rows.
     * @returns {this} The current instance of TableFormMessage.
     */
    setRows(rows) {
        this.rows = rows;
        return this;
    }
    /**
     * Adds a row to the table.
     * @param {Row} row The row to add.
     * @returns {this} The current instance of TableFormMessage.
     */
    addRow(row) {
        this.rows.push(row);
        return this;
    }
    /**
     * Gets the read-only forms.
     * @returns {ReadOnlyForm[]} The read-only forms.
     */
    getForms() {
        return this.forms;
    }
    /**
     * Sets the read-only forms.
     * @param {ReadOnlyForm[]} forms The read-only forms.
     * @returns {this} The current instance of TableFormMessage.
     */
    setForms(forms) {
        this.forms = forms;
        return this;
    }
    /**
     * Adds a read-only form.
     * @param {ReadOnlyForm} form The form to add.
     * @returns {this} The current instance of TableFormMessage.
     */
    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.
     * @returns {this} The current instance of TableFormMessage.
     */
    setFormColumns(formColumns) {
        this.formColumns = formColumns;
        return this;
    }
    /**
     * Gets the label for the show form button.
     * @returns {string} The label for the show form button.
     */
    getShowFormButtonLabel() {
        return this.showFormButtonLabel;
    }
    /**
     * Sets the label for the show form button.
     * @param {string} showFormButtonLabel The label for the show form button.
     * @returns {this} The current instance of TableFormMessage.
     */
    setShowFormButtonLabel(showFormButtonLabel) {
        this.showFormButtonLabel = showFormButtonLabel;
        return this;
    }
    /**
     * Gets the pagination information.
     * @returns {PaginationInfo} The pagination information.
     */
    getPaginationInfo() {
        return this.paginationInfo;
    }
    /**
     * Sets the pagination information.
     * @param {PaginationInfo} paginationInfo The pagination information.
     * @returns {this} The current instance of TableFormMessage.
     */
    setPaginationInfo(paginationInfo) {
        this.paginationInfo = paginationInfo;
        return this;
    }
    /**
     * Gets the index of the disclosed form.
     * @returns {number} The index of the disclosed form.
     */
    getDisclosedFormIndex() {
        return this.disclosedFormIndex;
    }
    /**
     * Sets the index of the disclosed form.
     * @param {number} disclosedFormIndex The index of the disclosed form.
     * @returns {this} The current instance of TableFormMessage.
     */
    setDisclosedFormIndex(disclosedFormIndex) {
        this.disclosedFormIndex = disclosedFormIndex;
        return this;
    }
}
exports.TableFormMessage = TableFormMessage;