import { Module, CacheModule } from '@nestjs/common';
import { QueryClientController } from './queryClient.controller';

import { CqrsModule } from '@nestjs/cqrs';
import { HttpModule } from '@nestjs/axios';
import { PlantationSiteRepository } from '../PlantationSiteOperationMicroserviceModule/repository/plantationSite-repository';
import { PlantationRepositoryMemoryAdapter } from '../PlantationSiteOperationMicroserviceModule/repository/memory/plantation-repository-memory.adapter';
import { FisAppRepository } from '../FisAppQueryMicroserviceModule/repository/fisapp-repository';
import { FisAppRepositoryMemoryAdapter } from '../FisAppQueryMicroserviceModule/repository/memory/fisapp-repository-memory.adapter';
import { QueryHandlers } from './queries';

@Module({
  imports: [CqrsModule, HttpModule, CacheModule.register()],
  controllers: [QueryClientController],
  providers: [
    {
      provide: PlantationSiteRepository,
      useClass: PlantationRepositoryMemoryAdapter,
    },
    {
      provide: FisAppRepository,
      useClass: FisAppRepositoryMemoryAdapter,
    },
    ...QueryHandlers,
  ]
})
export class QueryClientModule { }
