import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { VerificationCodeORM } from '../infrastructure/database/postgres/entities/verification-code.orm';
import { VerificationCodePostgresRepository } from '../adapters/outbound/persistence/verification-code-postgres.repository';
import { VERIFICATION_CODE_REPOSITORY } from '../domain/repositories/verification-code.repository.interface';
import { UserModule } from '../user/user.module';
import { AuthService } from '../application/services/auth.service';
import { AuthController } from '../adapters/inbound/auth.controller';

@Module({
  imports: [
    TypeOrmModule.forFeature([VerificationCodeORM]),
    UserModule,
  ],
  controllers: [AuthController],
  providers: [
    AuthService,
    {
      provide: VERIFICATION_CODE_REPOSITORY,
      useClass: VerificationCodePostgresRepository,
    },
  ],
  exports: [AuthService],
})
export class AuthModule {}
