import Guid from "./Guid"; export default class GraphPin { constructor(Options) { this.PinId = new Guid(Options?.PinId) this.PinName = Options?.PinName ?? "" this.PinToolTip = Options?.PinToolTip ?? "" this.PinType = { PinCategory: Options?.PinType?.PinCategory ?? "object", PinSubCategory: Options?.PinType?.PinSubCategory ?? "", PinSubCategoryMemberReference: Options?.PinType?.PinSubCategoryMemberReference ?? "", PinValueType: Options?.PinType?.PinValueType ?? "", PinValueType: Options?.PinType?.ContainerType ?? "None", bIsReference: Options?.PinType?.bIsReference ?? false, bIsConst: Options?.PinType?.bIsConst ?? false, bIsWeakPointer: Options?.PinType?.bIsWeakPointer ?? false, bIsUObjectWrapper: Options?.PinType?.bIsUObjectWrapper ?? false } this.LinkedTo = Options?.LinkedTo ?? null this.DefaultValue = Options?.DefaultValue ?? true this.AutogeneratedDefaultValue = Options?.AutogeneratedDefaultValue ?? false this.PersistentGuid = Options?.PersistentGuid ?? null this.bHidden = Options?.bHidden ?? false this.bNotConnectable = Options?.bNotConnectable ?? false this.bDefaultValueIsReadOnly = Options?.bDefaultValueIsReadOnly ?? false this.bDefaultValueIsIgnored = Options?.bDefaultValueIsIgnored ?? false this.bAdvancedView = Options?.bAdvancedView ?? false this.bOrphanedPin = Options?.bOrphanedPin ?? false } static serializeValue(value) { // No quotes if (value === null) { return '()' } if (value?.constructor?.name === 'Boolean') { return value ? 'True' : 'False' } if (value?.constructor?.name === 'ETypesNames' || value?.constructor?.name === 'FGuid') { return value.toString() } // Quotes if (value?.constructor?.name === 'String') { return `"${value}"` } } static subSerialize(prefix, object) { let result = "" prefix += prefix != "" ? "." : "" for (const property in object) { if (object[property]?.constructor?.name === 'Object') { result += GraphPin.subSerialize(prefix + property, object[property]) } else { result += `${prefix + property}=${GraphPin.serializeValue(object[property])},` } } return result } serialize() { let result = `CustomProperties Pin (${this.constructor.subSerialize('', this)})` return result } toString() { return this.serialize() } }