import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { OrderORM } from '../infrastructure/database/postgres/entities/order.orm';
import { OrderPostgresRepository } from '../adapters/outbound/persistence/order-postgres.repository';
import { ORDER_REPOSITORY } from '../domain/repositories/order.repository.interface';
import { OrderService } from '../application/services/order.service';
import { OrderController } from '../adapters/inbound/order.controller';

@Module({
  imports: [TypeOrmModule.forFeature([OrderORM])],
  controllers: [OrderController],
  providers: [
    OrderService,
    {
      provide: ORDER_REPOSITORY,
      useClass: OrderPostgresRepository,
    },
  ],
  exports: [OrderService, ORDER_REPOSITORY],
})
export class OrderModule {}
