"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ToggleField = void 0;
const internal_1 = require("../internal");
/**
* Represents a toggle field.
* @extends EditableField
*/
class ToggleField extends internal_1.EditableField {
/**
* Creates an instance of the ToggleField class.
* @param {string} id The unique identifier of the field.
* @param {string} label The label of the field.
* @param {any} valueOff The value when the toggle is off.
* @param {any} valueOn The value when the toggle is on.
*/
constructor(id, label, valueOff, valueOn) {
super(id);
this.displayType = 'toggle';
this.setLabel(label);
this.valueOff = valueOff;
this.valueOn = valueOn;
}
/**
* Gets the valueOn of the field.
* @returns {any} The valueOn of the field.
*/
getValueOn() {
return this.valueOn;
}
/**
* Sets the valueOn of the field.
* @param {any} valueOn The valueOn to set.
* @returns The updated instance of the ToggleField.
*/
setValueOn(valueOn) {
this.valueOn = valueOn;
return this;
}
/**
* Gets the valueOff of the field.
* @returns {any} The valueOff of the field.
*/
getValueOff() {
return this.valueOff;
}
/**
* Sets the valueOff of the field.
* @param {any} valueOff The valueOff to set.
* @returns The updated instance of the ToggleField.
*/
setValueOff(valueOff) {
this.valueOff = valueOff;
return this;
}
/**
* Gets the defaultValue of the field.
* @returns {any} The defaultValue of the field.
*/
getDefaultValue() {
return this.defaultValue;
}
/**
* Sets the defaultValue of the field.
* @param {any} defaultValue The defaultValue to set.
* @returns The updated instance of the ToggleField.
*/
setDefaultValue(defaultValue) {
this.defaultValue = defaultValue;
return this;
}
/**
* Gets the labelOn of the field.
* @returns {string} The labelOn of the field.
*/
getLabelOn() {
return this.labelOn;
}
/**
* Sets the labelOn of the field. This label is used to create a radio button when the channel does not support a toggle field.
* @param {string} labelOn The labelOn to set.
* @returns The updated instance of the ToggleField.
*/
setLabelOn(labelOn) {
this.labelOn = labelOn;
return this;
}
/**
* Gets the labelOff of the field.
* @returns {string} The labelOff of the field.
*/
getLabelOff() {
return this.labelOff;
}
/**
* Sets the labelOff of the field. This label is used to create a radio button when the channel does not support a toggle field.
* @param {string} labelOff The labelOff to set.
* @returns The updated instance of the ToggleField.
*/
setLabelOff(labelOff) {
this.labelOff = labelOff;
return this;
}
}
exports.ToggleField = ToggleField;