import * as faker from "faker" ; import * as ec from "../../../presentation-common/EC" ; import { createRandomId , nullable } from "./Misc" ; internal export const createRandomECInstanceId = ( ) : ec . InstanceId => { return createRandomId ( ) ; } ; internal export const createRandomECInstanceKey = ( ) : ec . InstanceKey => { return { className : faker . random . word ( ) , id : createRandomECInstanceId ( ) } ; } ; internal export const createRandomECInstanceKeyJSON = ( ) : ec . InstanceKeyJSON => { return { className : faker . random . word ( ) , id : createRandomECInstanceId ( ) } ; } ; internal export const createRandomECClassInfo = ( ) : ec . ClassInfo => { return { id : createRandomECInstanceId ( ) , name : faker . random . word ( ) , label : faker . random . words ( ) } ; } ; internal export const createRandomECClassInfoJSON = ( ) : ec . ClassInfoJSON => { return { id : createRandomId ( ) , name : faker . random . word ( ) , label : faker . random . words ( ) } ; } ; internal export const createRandomRelatedClassInfo = ( ) : ec . RelatedClassInfo => { return { sourceClassInfo : createRandomECClassInfo ( ) , targetClassInfo : createRandomECClassInfo ( ) , isPolymorphicTargetClass : faker . random . boolean ( ) , relationshipInfo : createRandomECClassInfo ( ) , isForwardRelationship : faker . random . boolean ( ) , isPolymorphicRelationship : faker . random . boolean ( ) } ; } ; internal export const createRandomRelatedClassInfoJSON = ( ) : ec . RelatedClassInfoJSON => { return { sourceClassInfo : createRandomECClassInfoJSON ( ) , targetClassInfo : createRandomECClassInfoJSON ( ) , isPolymorphicTargetClass : nullable ( ( ) => faker . random . boolean ( ) ) , relationshipInfo : createRandomECClassInfoJSON ( ) , isForwardRelationship : faker . random . boolean ( ) , isPolymorphicRelationship : nullable ( ( ) => faker . random . boolean ( ) ) } ; } ; internal export const createRandomRelationshipPath = ( length = 2 ) : ec . RelationshipPath => { const path = new Array < ec . RelatedClassInfo > ( ) ; while ( length -- ) path . push ( createRandomRelatedClassInfo ( ) ) ; return path ; } ; internal export const createRandomRelationshipPathJSON = ( length = 2 ) : ec . RelationshipPathJSON => { const path = new Array < ec . RelatedClassInfoJSON > ( ) ; while ( length -- ) path . push ( createRandomRelatedClassInfoJSON ( ) ) ; return path ; } ; internal export const createRandomPropertyInfoJSON = ( ) : ec . PropertyInfoJSON => ( { classInfo : createRandomECClassInfoJSON ( ) , name : faker . random . word ( ) , type : "string" } ) ;