import type { IModelOptions } from '../types' ; export function Model ( Entity , options ? ) { return function ( target , propertyKey , parameterIndex ? ) : void { let metadataKey ; if ( typeof propertyKey === 'undefined' && typeof parameterIndex === 'number' ) { metadataKey = 'fastify-resty:inject:constructor:model' ; } else if ( typeof propertyKey === 'string' && typeof parameterIndex === 'undefined' ) { metadataKey = 'fastify-resty:inject:properties:model' ; } if ( metadataKey ) { const injectMap = Reflect . getMetadata ( metadataKey , target ) || new Map ( ) ; injectMap . set ( propertyKey || parameterIndex , { Entity , options } ) ; Reflect . defineMetadata ( metadataKey , injectMap , target ) ; } } ; }