import { NgModule, RendererFactory2, Type } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DragDirective } from './drag.directive';
import { DropListDirective } from './drop-list.directive';
import { DropPlaceDirective } from './drop-place.directive';
import { AppDragDropService } from './app-drag-drop.service';
import { SidebarElementDragPreviewComponent } from 'src/app/components/resources-sidebar/sidebar-element-drag-preview/sidebar-element-drag-preview.component';

@NgModule({
  declarations: [
    DragDirective,
    DropListDirective,
    DropPlaceDirective
  ],
  imports: [
    CommonModule
  ],
  providers: [
    { 
      provide: AppDragDropService,
      useFactory: (rendererFactory: RendererFactory2)=>{
        
        let dndServiceConfigMap = new Map<string, Type<any>>();
        dndServiceConfigMap.set('resource', SidebarElementDragPreviewComponent);

        return new AppDragDropService(rendererFactory, dndServiceConfigMap);
      },
      deps: [RendererFactory2]
    }
  ],
  exports: [
    DragDirective,
    DropListDirective,
    DropPlaceDirective
  ]
})
export class AppDragDropModule {}
