import { Module } from "@nestjs/common";

import { UsersModule } from "@bff/modules/users/users.module.js";
import { TokensModule } from "../tokens/tokens.module.js";
import { SessionsModule } from "../sessions/sessions.module.js";
import { OtpModule } from "../otp/otp.module.js";
import { SharedAuthModule } from "../shared/shared-auth.module.js";

import { AuthLoginService } from "../application/auth-login.service.js";
import { LoginOtpWorkflowService } from "../infra/workflows/login-otp-workflow.service.js";
import { FailedLoginThrottleGuard } from "../presentation/http/guards/failed-login-throttle.guard.js";
import { LoginResultInterceptor } from "../presentation/http/interceptors/login-result.interceptor.js";

/**
 * Login Module
 *
 * Owns credential validation, login OTP workflow, and login-specific
 * guards/interceptors. Imports TokensModule, SessionsModule, and OtpModule
 * for token generation, session management, and OTP verification.
 *
 */
@Module({
  imports: [TokensModule, SessionsModule, OtpModule, UsersModule, SharedAuthModule],
  providers: [
    AuthLoginService,
    LoginOtpWorkflowService,
    FailedLoginThrottleGuard,
    LoginResultInterceptor,
  ],
  exports: [
    AuthLoginService,
    LoginOtpWorkflowService,
    FailedLoginThrottleGuard,
    LoginResultInterceptor,
  ],
})
export class LoginModule {}
