import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { CqrsModule } from '@nestjs/cqrs';
import { TypeOrmModule } from '@nestjs/typeorm';
import { LogModel } from './data/models/log.model';
import { ErrorLogModel } from './data/models/error-log.model';
import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants';
import { RecordErrorLogHandler } from './domain/handlers/error-log.handler';
import { RecordLogHandler } from './domain/handlers/log.handler';
import { ErrorLogService } from './data/services/error-log.service';
import { LogService } from './data/services/log.service';
import { PosLogModel } from './data/models/pos-log.model';
import { PosLogService } from './data/services/pos-log.service';
import { RecordPosLogHandler } from './domain/handlers/pos-log.handler';
import { LogUserLoginModel } from './data/models/log-user-login.model';
import { LogUserLoginService } from './data/services/log-user-login.service';
import { LogUserLoginHandler } from './domain/handlers/log-user-login.handler';

@Module({
  imports: [
    ConfigModule.forRoot(),
    TypeOrmModule.forFeature(
      [LogModel, ErrorLogModel, PosLogModel, LogUserLoginModel],
      CONNECTION_NAME.DEFAULT,
    ),
    CqrsModule,
  ],
  controllers: [],
  providers: [
    RecordLogHandler,
    RecordPosLogHandler,
    RecordErrorLogHandler,
    LogUserLoginHandler,

    LogService,
    PosLogService,
    ErrorLogService,
    LogUserLoginService,
  ],
})
export class LogModule {}
