import { XMLElem, type IToXML } from "@/util/XmlElem"; import { UABaseNode, type UABaseNodeOptions } from "./UABaseNode"; import type { NamespaceTable } from "./NameSpaceTable"; import type { IAddressSpace } from "./IAddressSpace"; export class UAType extends UABaseNode implements IToXML { public purpose?: string public isAbstract?: boolean; constructor(options: UATypeOptions) { super(options); Object.assign(this, options); this.nodeClass="UAType"; } toXML(lnst:NamespaceTable, gnst:NamespaceTable): XMLElem { const elem=super.toXML(lnst, gnst); elem.name=this.nodeClass; elem.attr("Purpose", this.purpose); elem.attr('IsAbstract', this.isAbstract); return elem; } static fromXML(uaObject: any, addressSpace: IAddressSpace): UAType{ const bn=super.fromXML(uaObject, addressSpace) as UATypeOptions bn.purpose=uaObject['@_Purpose']||"Normal"; bn.isAbstract=uaObject['@_IsAbstract']||false; return new UAType(bn as UATypeOptions); } } export interface UATypeOptions extends UABaseNodeOptions{ purpose?:string; isAbstract?:string; }