import { Global, Module } from '@nestjs/common';
import { CardsService } from './cards.service';
import { CardsController } from './cards.controller';
import { DealCardsCmdHandler } from './command-handlers/deal-cards.cmd.handler';
import { MongooseModule } from '@nestjs/mongoose';
import { Card, CardSchema } from '../schemas/cards.schema';
import { CqrsModule } from '@nestjs/cqrs';
import { StateModule } from '../state/state.module';
import { CardsUserRegisteredEventHandler } from './event-handlers/cards-user-registered.event.handler';
import {ConfigService} from "@nestjs/config";
import {NextQuestionEventHandler} from "./event-handlers/next-question-event.handler";
@Global()
@Module({
  imports: [
    MongooseModule.forFeature([{ name: Card.name, schema: CardSchema }]),
    CqrsModule,
    StateModule,
  ],
  providers: [
    CardsService,
    DealCardsCmdHandler,
    CardsUserRegisteredEventHandler,
    NextQuestionEventHandler,
    ConfigService
  ],
  controllers: [CardsController],
  exports: [CardsService]
})
export class CardsModule {}
