import { Module } from '@nestjs/common';
import { PassportModule } from '@nestjs/passport';
import { AuthentikAuthService } from './services/authentik-auth.service';
import { UsersModule } from '../users-management/users.module';
import { AuthController } from './controllers/auth.controller';
import { AuthentikStrategy } from './strategies/authentik.strategy';
import { ExpressSessionSerializer } from './serializers/express-session.serializer';
import { UsersService } from 'src/identity-and-account/users-management/services/users.service';


@Module({
  imports: [ PassportModule.register({ 
    session: true,
    defaultStrategy: 'openidconnect' 
  }), UsersModule, ],
  providers: [ 
    AuthentikAuthService, 
    AuthentikStrategy, 
    ExpressSessionSerializer,
    UsersService,
  ],
  exports: [ AuthentikAuthService ],
  controllers: [AuthController],
})
export class AuthenticationModule {}
