import { Global, Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { TypeOrmModule } from '@nestjs/typeorm';
import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants';
import { ItemRateDataService } from './data/services/item-rate-data.service';
import { ItemRateReadService } from './data/services/item-rate-read.service';
import { ItemRateReadController } from './infrastructure/item-rate-read.controller';
import { ItemRateReadOrchestrator } from './domain/usecases/item-rate-read.orchestrator';
import { ItemRateDataController } from './infrastructure/item-rate-data.controller';
import { ItemRateDataOrchestrator } from './domain/usecases/item-rate-data.orchestrator';
import { CreateItemRateManager } from './domain/usecases/managers/create-item-rate.manager';
import { CqrsModule } from '@nestjs/cqrs';
import { IndexItemRateManager } from './domain/usecases/managers/index-item-rate.manager';
import { DeleteItemRateManager } from './domain/usecases/managers/delete-item-rate.manager';
import { UpdateItemRateManager } from './domain/usecases/managers/update-item-rate.manager';
import { DetailItemRateManager } from './domain/usecases/managers/detail-item-rate.manager';
import { BatchDeleteItemRateManager } from './domain/usecases/managers/batch-delete-item-rate.manager';
import { ItemRateModel } from './data/models/item-rate.model';
import { SeasonPeriodHolidayHandler } from './domain/usecases/handlers/item-created.handler';
import { SeasonPeriodDataService } from 'src/modules/season-related/season-period/data/services/season-period-data.service';
import { SeasonPeriodModel } from 'src/modules/season-related/season-period/data/models/season-period.model';
import { ItemModel } from '../item/data/models/item.model';

@Global()
@Module({
  imports: [
    ConfigModule.forRoot(),
    TypeOrmModule.forFeature(
      [ItemRateModel, SeasonPeriodModel, ItemModel],
      CONNECTION_NAME.DEFAULT,
    ),
    CqrsModule,
  ],
  controllers: [ItemRateDataController, ItemRateReadController],
  providers: [
    SeasonPeriodHolidayHandler,

    IndexItemRateManager,
    DetailItemRateManager,
    CreateItemRateManager,
    DeleteItemRateManager,
    UpdateItemRateManager,
    BatchDeleteItemRateManager,

    SeasonPeriodDataService,
    ItemRateDataService,
    ItemRateReadService,

    ItemRateDataOrchestrator,
    ItemRateReadOrchestrator,
  ],
  exports: [ItemRateDataService, ItemRateReadService],
})
export class ItemRateModule {}
