1 import { SchemaPropertyGroupModel, SchemaProperty } from '../aschema-property';
2 import { PROPERTY_DATA, PROPERTY_TYPES} from 'app/utils';
3 import { PropertyBEModel } from '../../models';
5 export enum DerivedPropertyType {
9 COMPLEX //other datatype, list of non-simple, or map of non-simple
12 export class DerivedFEProperty extends PropertyBEModel {
14 propertiesName: string; //"network_assignments#ipv4_subnet#use_ipv4 = parentPath + name
15 derivedDataType: DerivedPropertyType;
19 isChildOfListOrMap: boolean;
21 constructor(property: PropertyBEModel, parentName?: string)
22 constructor(name: string, parentName: string, type: string, value: string, isChildOfListOrMap?:boolean, schema?: SchemaPropertyGroupModel);
23 constructor(nameOrPropertyObj?: string | PropertyBEModel, parentName?: string, type?: string, value?: string, isChildOfListOrMap?: boolean, schema?: SchemaPropertyGroupModel) {
25 super(typeof nameOrPropertyObj === 'string' ? null : nameOrPropertyObj);
27 if (typeof nameOrPropertyObj !== 'string') { //constructor #1
28 this.parentName = parentName ? parentName : null;
29 this.propertiesName = (parentName) ? parentName + '#' + nameOrPropertyObj.name : nameOrPropertyObj.name;
30 } else { //constructor #2
31 this.name = nameOrPropertyObj;
33 this.parentName = parentName;
34 this.propertiesName = parentName + '#' + nameOrPropertyObj;
37 this.schema = new SchemaPropertyGroupModel(new SchemaProperty(schema.property));
40 this.derivedDataType = this.getDerivedPropertyType();
41 this.isChildOfListOrMap = (isChildOfListOrMap) ? isChildOfListOrMap : false;
44 public getDerivedPropertyType = () => {
45 if (PROPERTY_DATA.SIMPLE_TYPES.indexOf(this.type) > -1) {
46 return DerivedPropertyType.SIMPLE;
47 } else if (this.type == PROPERTY_TYPES.LIST) {
48 return DerivedPropertyType.LIST;
49 } else if (this.type == PROPERTY_TYPES.MAP) {
50 return DerivedPropertyType.MAP;
52 return DerivedPropertyType.COMPLEX;
57 export class DerivedFEPropertyMap {
58 [parentPath: string]: Array<DerivedFEProperty>;
63 // isDataType: boolean;
67 // canCollapse: boolean;
68 // canBeDeclared: boolean;
70 // derivedValue: string;
71 // derivedValueType: string;
72 // propertiesName: string;