typings/lib2/messagev2/common/readOnlyForm.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReadOnlyForm = void 0;
const internal_1 = require("../internal");
/**
 * Represents a read-only form.
 * @extends ChannelCustomizable
 */
class ReadOnlyForm extends internal_1.ChannelCustomizable {
    /**
     * Creates an instance of the ReadOnlyForm class.
     * @param {ReadOnlyField[]} [fields] The list of fields in the read-only form.
     */
    constructor(fields) {
        super();
        this.fields = [];
        this.formRows = [];
        if (fields) {
            this.fields = fields;
        }
    }
    /**
     * Deserialize nested object properties into corresponding class instances
     */
    deserializeNestedProperties() {
        super.deserializeNestedProperties();
        if (this.voice) {
            this.voice = internal_1.MessageUtil.deserializeVoice(this.voice);
        }
        if (this.fields) {
            this.fields = internal_1.MessageUtil.deserializeFields(this.fields);
        }
        if (this.formRows) {
            this.formRows = internal_1.MessageUtil.deserializeFormRows(this.formRows);
        }
        if (this.actions) {
            this.actions = internal_1.MessageUtil.deserializeActions(this.actions);
        }
        if (this.selectAction) {
            this.selectAction = internal_1.MessageUtil.deserializeAction(this.selectAction);
        }
    }
    /**
     * Gets the ID of the read-only form.
     * @returns {string} The ID of the read-only form.
     */
    getId() {
        return this.id;
    }
    /**
     * Sets the ID of the read-only form.
     * @param {string} id The ID to set.
     * @returns {ReadOnlyForm} The updated instance of the ReadOnlyForm.
     */
    setId(id) {
        this.id = id;
        return this;
    }
    /**
     * Gets the title of the read-only form.
     * @returns {string} The title of the read-only form.
     */
    getTitle() {
        return this.title;
    }
    /**
     * Sets the title of the read-only form.
     * @param {string} title The title to set.
     * @returns {ReadOnlyForm} The updated instance of the ReadOnlyForm.
     */
    setTitle(title) {
        this.title = title;
        return this;
    }
    /**
     * Gets the voice settings of the read-only form.
     * @returns {Voice} the voice settings of the read-only form.
     */
    getVoice() {
        return this.voice;
    }
    /**
     * Sets the voice settings of the read-only form.
     * @param {Voice} voice The voice to set.
     * @returns {ReadOnlyForm} The updated instance of the ReadOnlyForm.
     */
    setVoice(voice) {
        this.voice = voice;
        return this;
    }
    /**
     * Gets the list of fields in the read-only form.
     * @returns {ReadOnlyField[]} The list of fields in the read-only form.
     */
    getFields() {
        return this.fields;
    }
    /**
     * Sets the fields of the read-only form.
     * @param {ReadOnlyField[]} fields The fields to set.
     * @returns {ReadOnlyForm} The updated instance of the ReadOnlyForm.
     */
    setFields(fields) {
        this.fields = fields;
        return this;
    }
    /**
     * Adds a field to the read-only form.
     * @param {ReadOnlyField} field The field to add.
     * @returns {ReadOnlyForm} The updated instance of the ReadOnlyForm.
     */
    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 {ReadOnlyForm} The updated instance of the ReadOnlyForm.
     */
    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 {ReadOnlyForm} The updated instance of the ReadOnlyForm.
     */
    addFormRow(formRow) {
        this.formRows.push(formRow);
        return this;
    }
    /**
     * Gets the list of actions in the read-only form.
     * @returns {Action[]} The list of actions in the read-only form.
     */
    getActions() {
        return this.actions;
    }
    /**
     * Adds an action to the read-only form.
     * @param {Action} action The action to add.
     * @returns {ReadOnlyForm} The updated instance of the ReadOnlyForm.
     */
    addAction(action) {
        if (!this.actions) {
            this.actions = [];
        }
        this.actions.push(action);
        return this;
    }
    /**
     * Gets the select action of the read-only form.
     * @returns The select action of the read-only form.
     */
    getSelectAction() {
        return this.selectAction;
    }
    /**
     * Sets the select action of the read-only form.
     * @param selectAction The select action to set.
     * @returns The updated instance of the ReadOnlyForm.
     */
    setSelectAction(selectAction) {
        this.selectAction = selectAction;
        return this;
    }
}
exports.ReadOnlyForm = ReadOnlyForm;