typings/lib2/messagev2/messagePayload/editFormMessage.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EditFormMessage = void 0;
const internal_1 = require("../internal");
/**
 * Represents an edit form message.
 * @extends NonRawMessage
 */
class EditFormMessage extends internal_1.NonRawMessage {
    /**
     * Creates an instance of the EditFormMessage class.
     * @param {Field[]} fields The list of fields in the edit form message.
     */
    constructor(fields) {
        super();
        this.type = 'editForm';
        this.formColumns = 1;
        this.fields = [];
        this.formRows = [];
        if (fields) {
            this.fields = fields;
        }
    }
    /**
     * Deserialize nested object properties into corresponding class instances
     */
    deserializeNestedProperties() {
        super.deserializeNestedProperties();
        if (this.fields) {
            this.fields = internal_1.MessageUtil.deserializeFields(this.fields);
        }
        if (this.formRows) {
            this.formRows = internal_1.MessageUtil.deserializeFormRows(this.formRows);
        }
    }
    /**
     * Gets the title of the edit form message.
     * @returns {string} The title of the edit form message.
     */
    getTitle() {
        return this.title;
    }
    /**
     * Sets the title of the edit form message.
     * @param {string} title The title to set.
     * @returns {EditFormMessage} The updated instance of the EditFormMessage.
     */
    setTitle(title) {
        this.title = title;
        return this;
    }
    /**
     * Gets the number of form columns in the edit form message.
     * @returns {number} The number of form columns in the edit form message.
     */
    getFormColumns() {
        return this.formColumns;
    }
    /**
     * Sets the number of form columns in the edit form message.
     * @param {number} formColumns The number of form columns to set.
     * @returns {EditFormMessage} The updated instance of the EditFormMessage.
     */
    setFormColumns(formColumns) {
        this.formColumns = formColumns;
        return this;
    }
    /**
     * Gets the list of fields in the edit form message.
     * @returns {Field[]} The list of fields in the edit form message.
     */
    getFields() {
        return this.fields;
    }
    /**
     * Sets the fields of the edit form message.
     * @param {Field[]} fields The fields to set.
     * @returns {EditFormMessage} The updated instance of the EditFormMessage.
     */
    setFields(fields) {
        this.fields = fields;
        return this;
    }
    /**
     * Adds a field to the edit form message.
     * @param {Field} field The field to add.
     * @returns {EditFormMessage} The updated instance of the EditFormMessage.
     */
    addField(field) {
        this.fields.push(field);
        return this;
    }
    /**
     * Gets the list of form rows in the edit form message.
     * @returns {FormRow[]} The list of form rows in the edit form message.
     */
    getFormRows() {
        return this.formRows;
    }
    /**
     * Sets the form rows of the edit form message.
     * @param {FormRow[]} formRows The form rows to set.
     * @returns {EditFormMessage} The updated instance of the EditFormMessage.
     */
    setFormRows(formRows) {
        this.formRows = formRows;
        return this;
    }
    /**
     * Adds a form row to the edit form message.
     * @param {FormRow} formRow The form row to add.
     * @returns {EditFormMessage} The updated instance of the EditFormMessage.
     */
    addFormRow(formRow) {
        this.formRows.push(formRow);
        return this;
    }
    /**
     * Gets the error message of the edit form message.
     * @returns {string} The error message of the edit form message.
     */
    getErrorMessage() {
        return this.errorMessage;
    }
    /**
     * Sets the error message of the edit form message.
     * @param {string} errorMessage The error message to set.
     * @returns {EditFormMessage} The updated instance of the EditFormMessage.
     */
    setErrorMessage(errorMessage) {
        this.errorMessage = errorMessage;
        return this;
    }
}
exports.EditFormMessage = EditFormMessage;