import { ConfigModule } from '@nestjs/config';
import { CouchDataController } from './infrastructure/couch.controller';
import { Module } from '@nestjs/common';
import { CouchService } from './data/services/couch.service';
import { CqrsModule } from '@nestjs/cqrs';
import {
  PaymentMethodUpdatedHandler,
  PaymentMethodDeletedHandler,
} from './domain/managers/payment-method.handler';
import {
  VipCategoryDeletedHandler,
  VipCategoryUpdatedHandler,
} from './domain/managers/vip-category.handler';
import {
  SeasonPeriodDeletedHandler,
  SeasonPeriodUpdatedHandler,
} from './domain/managers/season-period.handler';
import {
  ItemDeletedHandler,
  ItemPriceUpdatedHandler,
  ItemRateUpdatedHandler,
  ItemUpdatedHandler,
} from './domain/managers/item.handler';
import {
  UserDeletedHandler,
  UserPrivilegeUpdateHandler,
  UserUpdatedHandler,
} from './domain/managers/user.handler';
import { TypeOrmModule } from '@nestjs/typeorm';
import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants';
import { ItemModel } from 'src/modules/item-related/item/data/models/item.model';
import { UserModel } from 'src/modules/user-related/user/data/models/user.model';
import { UserDataService } from 'src/modules/user-related/user/data/services/user-data.service';
import { ItemDataService } from 'src/modules/item-related/item/data/services/item-data.service';
import {
  BookingDeletedEvent,
  // BookingHandler,
  BookingUpdateHandler,
  ChangeStatusBookingHandler,
} from './domain/managers/booking.handler';
import { TransactionDataService } from 'src/modules/transaction/transaction/data/services/transaction-data.service';
import { TransactionModel } from 'src/modules/transaction/transaction/data/models/transaction.model';
import { TransactionTaxModel } from 'src/modules/transaction/transaction/data/models/transaction-tax.model';
import { TransactionItemModel } from 'src/modules/transaction/transaction/data/models/transaction-item.model';
import { VipCodeCreatedHandler } from './domain/managers/vip-code.handler';
import { ItemRateModel } from 'src/modules/item-related/item-rate/data/models/item-rate.model';
import {
  SeasonTypeDeletedHandler,
  SeasonTypeUpdatedHandler,
} from './domain/managers/season-type.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 { TransactionDemographyModel } from 'src/modules/transaction/transaction/data/models/transaction-demography.model';
import { UserLoginModel } from 'src/modules/user-related/user/data/models/user-login.model';
import {
  TimeGroupDeletedHandler,
  TimeGroupUpdatedHandler,
} from './domain/managers/time-group.handle';

import { DataSchedulingUpdatedHandler } from './domain/managers/data-scheduling.handler';
import { DataSchedulingDefaultModel } from '../data-scheduling/data/models/data-scheduling-default.model';
import { DataSchedulingModel } from '../data-scheduling/data/models/data-scheduling.model';

@Module({
  imports: [
    ConfigModule.forRoot(),
    TypeOrmModule.forFeature(
      [
        ItemModel,
        ItemRateModel,
        SeasonPeriodModel,
        UserModel,
        UserLoginModel,
        TransactionModel,
        TransactionTaxModel,
        TransactionItemModel,
        TransactionDemographyModel,

        DataSchedulingDefaultModel,
        DataSchedulingModel,
      ],
      CONNECTION_NAME.DEFAULT,
    ),
    CqrsModule,
  ],
  controllers: [CouchDataController],
  providers: [
    // BookingHandler,
    BookingUpdateHandler,
    ChangeStatusBookingHandler,
    BookingDeletedEvent,
    PaymentMethodDeletedHandler,
    PaymentMethodUpdatedHandler,
    VipCodeCreatedHandler,
    VipCategoryDeletedHandler,
    VipCategoryUpdatedHandler,

    TimeGroupDeletedHandler,
    TimeGroupUpdatedHandler,

    SeasonPeriodDeletedHandler,
    SeasonPeriodUpdatedHandler,
    ItemUpdatedHandler,
    ItemDeletedHandler,
    ItemRateUpdatedHandler,
    ItemPriceUpdatedHandler,
    UserDeletedHandler,
    UserUpdatedHandler,
    UserPrivilegeUpdateHandler,

    SeasonTypeDeletedHandler,
    SeasonTypeUpdatedHandler,

    DataSchedulingUpdatedHandler,

    SeasonPeriodDataService,
    TransactionDataService,
    UserDataService,
    ItemDataService,
    CouchService,
  ],
  exports: [CouchService],
})
export class CouchModule {}
