import { Reference } from './Reference' ; import type { AnyEntity , EntityData , EntityDTO , IWrappedEntity } from '../typings' ; import type { AssignOptions } from './EntityAssigner' ; import { EntityAssigner } from './EntityAssigner' ; export abstract class BaseEntity < T , PK extends keyof T , P extends string = never > implements IWrappedEntity < T , PK , P > { isInitialized ( ) { return ( this as unknown as AnyEntity < T > ) . __helper ! . __initialized ; } isTouched ( ) { return ( this as unknown as AnyEntity < T > ) . __helper ! . __touched ; } populated ( populated = true ) { ( this as unknown as AnyEntity < T > ) . __helper ! . populated ( populated ) ; } toReference ( ) { return Reference . create ( this ) as any ; } toObject ( ignoreFields = [ ] ) { return ( this as unknown as AnyEntity < T > ) . __helper ! . toObject ( ignoreFields ) ; } toJSON ( ... args ) { return this . toObject ( ... args ) ; } toPOJO ( ) { return ( this as unknown as AnyEntity < T > ) . __helper ! . toPOJO ( ) ; } assign ( data , options ? ) { return EntityAssigner . assign ( this as unknown as T , data , options ) ; } init ( populated = true ) { return ( this as unknown as AnyEntity < T > ) . __helper ! . init ( populated ) ; } getSchema ( ) { return ( this as unknown as AnyEntity < T > ) . __helper ! . getSchema ( ) ; } setSchema ( schema ? ) { ( this as unknown as AnyEntity < T > ) . __helper ! . setSchema ( schema ) ; } } Object . defineProperty ( BaseEntity . prototype , '__baseEntity' , { value : true , writable : false , enumerable : false } ) ;