import { Condition } from "../conditions/condition" ; import { ConditionsModel } from "../conditions/condition-model" ; export type ConditionWrapperValue = string | { name : string ; conditions : Condition [ ] ; } ; export type ConditionRawData = { name : string ; displayName : string ; value : ConditionWrapperValue ; } ; export class ConditionsWrapper { name : string ; displayName : string ; value : ConditionWrapperValue ; constructor ( rawData ) { const { name , displayName , value } = rawData ; this . displayName = displayName || name ; this . value = value ; this . name = name ; } get expression ( ) { if ( typeof this . value === "string" ) { return this . value ; } return ConditionsModel . from ( this . value ) . toExpression ( ) ; } clone ( ) { return new ConditionsWrapper ( this ) ; } }