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

// Feature modules
import { TokensModule } from "./tokens/tokens.module.js";
import { OtpModule } from "./otp/otp.module.js";
import { SessionsModule } from "./sessions/sessions.module.js";
import { LoginModule } from "./login/login.module.js";
import { GetStartedModule } from "./get-started/get-started.module.js";
import { PasswordResetModule } from "./password-reset/password-reset.module.js";
import { SharedAuthModule } from "./shared/shared-auth.module.js";

// External modules
import { UsersModule } from "@bff/modules/users/users.module.js";
import { MappingsModule } from "@bff/modules/id-mappings/mappings.module.js";
import { IntegrationsModule } from "@bff/integrations/integrations.module.js";
import { CacheModule } from "@bff/infra/cache/cache.module.js";
import { WorkflowModule } from "@bff/modules/shared/workflow/index.js";

// Orchestrator-level services (not owned by any feature module)
import { AuthOrchestrator } from "./application/auth-orchestrator.service.js";
import { AuthHealthService } from "./application/auth-health.service.js";

// Controller
import { AuthController } from "./presentation/http/auth.controller.js";

@Module({
  imports: [
    // Auth feature modules
    TokensModule,
    OtpModule,
    SessionsModule,
    LoginModule,
    GetStartedModule,
    PasswordResetModule,
    SharedAuthModule,
    // External modules
    UsersModule,
    MappingsModule,
    IntegrationsModule,
    CacheModule,
    WorkflowModule,
  ],
  controllers: [AuthController],
  providers: [AuthOrchestrator, AuthHealthService],
  exports: [AuthOrchestrator, TokensModule, SharedAuthModule],
})
export class AuthModule {}
