typings/lib2/messagev2/common/row.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Row = void 0;
const internal_1 = require("../internal");
/**
 * Represents a row in a channel customizable element.
 * @extends ChannelCustomizable
 */
class Row extends internal_1.ChannelCustomizable {
    /**
     * Creates an instance of the Row class.
     * @param {ReadOnlyField[]} fields The list of fields in the row
     */
    constructor(fields) {
        super();
        this.fields = [];
        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.selectAction) {
            this.selectAction = internal_1.MessageUtil.deserializeAction(this.selectAction);
        }
    }
    /**
     * Gets the fields in the row.
     * @returns {ReadOnlyField[]} The array of fields.
     */
    getFields() {
        return this.fields;
    }
    /**
     * Adds a field to the row.
     * @param {ReadOnlyField} field The field to add.
     * @returns {Row} The updated instance of the Row.
     */
    addField(field) {
        this.fields.push(field);
        return this;
    }
    /**
     * Gets the select action of the row.
     * @returns The select action.
     */
    getSelectAction() {
        return this.selectAction;
    }
    /**
     * Sets the select action of the row.
     * @param selectAction The select action to set.
     * @returns The updated instance of the Row.
     */
    setSelectAction(selectAction) {
        this.selectAction = selectAction;
        return this;
    }
}
exports.Row = Row;