2023-02-09 22:21:20 -06:00
|
|
|
import { type FieldStatus } from '../enums/FieldStatus';
|
|
|
|
|
import { type FieldType } from '../enums/FieldType';
|
|
|
|
|
import { type FormulaOutputType } from '../enums/FormulaOutputType';
|
2023-02-04 22:00:19 -06:00
|
|
|
import { Field } from './Field';
|
|
|
|
|
import { type ListValue } from './ListValue';
|
|
|
|
|
|
2023-02-05 15:32:22 -06:00
|
|
|
/**
|
|
|
|
|
* @class FormulaField - Represents a formula field.
|
|
|
|
|
*/
|
2023-02-04 22:00:19 -06:00
|
|
|
export class FormulaField extends Field {
|
2023-02-05 15:32:22 -06:00
|
|
|
/**
|
|
|
|
|
* @property {FormulaOutputType} outputType - The output type of the formula.
|
|
|
|
|
*/
|
2023-02-04 22:00:19 -06:00
|
|
|
public outputType: FormulaOutputType;
|
2023-02-05 15:32:22 -06:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @property {ListValue[]} values - The list values of the formula.
|
|
|
|
|
*/
|
2023-02-04 22:00:19 -06:00
|
|
|
public values: ListValue[];
|
|
|
|
|
|
2023-02-05 15:32:22 -06:00
|
|
|
/**
|
|
|
|
|
* @constructor - Creates a new FormulaField.
|
|
|
|
|
* @param {number} id - The id of the formula field.
|
|
|
|
|
* @param {number} appId - The id of the app the formula field belongs to.
|
|
|
|
|
* @param {string} name - The name of the formula field.
|
2023-02-09 22:21:20 -06:00
|
|
|
* @param {FieldType} type - The type of the formula field.
|
|
|
|
|
* @param {FieldStatus} status - The status of the formula field.
|
2023-02-05 15:32:22 -06:00
|
|
|
* @param {boolean} isRequired - Whether the formula field is required.
|
|
|
|
|
* @param {boolean} isUnique - Whether the formula field is unique.
|
2023-02-09 22:21:20 -06:00
|
|
|
* @param {FormulaOutputType} outputType - The output type of the formula field.
|
2023-02-05 15:32:22 -06:00
|
|
|
* @param {ListValue[]} values - The list values of the formula field.
|
|
|
|
|
* @returns {FormulaField} - A new FormulaField.
|
|
|
|
|
*/
|
2023-02-04 22:00:19 -06:00
|
|
|
constructor(
|
|
|
|
|
id: number,
|
|
|
|
|
appId: number,
|
|
|
|
|
name: string,
|
2023-02-09 22:21:20 -06:00
|
|
|
type: FieldType,
|
|
|
|
|
status: FieldStatus,
|
2023-02-04 22:00:19 -06:00
|
|
|
isRequired: boolean,
|
|
|
|
|
isUnique: boolean,
|
2023-02-09 22:21:20 -06:00
|
|
|
outputType: FormulaOutputType,
|
2023-02-04 22:00:19 -06:00
|
|
|
values: ListValue[]
|
|
|
|
|
) {
|
|
|
|
|
super(id, appId, name, type, status, isRequired, isUnique);
|
2023-02-09 22:21:20 -06:00
|
|
|
this.outputType = outputType;
|
2023-02-04 22:00:19 -06:00
|
|
|
this.values = values;
|
|
|
|
|
}
|
|
|
|
|
}
|