import { Module, forwardRef } from '@nestjs/common';
import { PaymentsService } from './services/payments.service';
import { MikroOrmModule } from '@mikro-orm/nestjs';
import { PaymentMethod } from './entities/payment-method.entity';
import { PaymentMethodRepository } from './repositories/payment-method.repository';
import { PaymentMethodService } from './services/payment-method.service';
import { Restaurant } from '../restaurants/entities/restaurant.entity';
import { PaymentsController } from './controllers/payments.controller';
import { AuthModule } from '../auth/auth.module';
import { JwtModule } from '@nestjs/jwt';
import { Payment } from './entities/payment.entity';
import { ZarinpalGateway } from './gateways/zarinpal.gateway';
import { GatewayManager } from './gateways/gateway.manager';
import { PaymentRepository } from './repositories/payment.repository';
import { InventoryModule } from '../inventory/inventory.module';
import { PaymentListeners } from './listeners/payment.listeners';
import { AdminModule } from '../admin/admin.module';
import { NotificationsModule } from '../notifications/notifications.module';
import { OrdersModule } from '../orders/orders.module';
import { RestaurantsModule } from '../restaurants/restaurants.module';

@Module({
  imports: [MikroOrmModule.forFeature([PaymentMethod, Payment, Restaurant]),
    AuthModule, JwtModule, InventoryModule, AdminModule, NotificationsModule,
    RestaurantsModule,
  forwardRef(() => OrdersModule)],
  controllers: [PaymentsController],
  providers: [PaymentsService, PaymentMethodService, PaymentMethodRepository,
    PaymentRepository, ZarinpalGateway, GatewayManager, PaymentListeners],
  exports: [
    PaymentMethodRepository,
    PaymentRepository,
    PaymentMethodService,
    PaymentsService,
  ],
})
export class PaymentsModule { }
