import { Module } from "@nestjs/common";
import { UsersModule } from "src/users/users.module";
import { AuthService } from "./auth.service";
import { PassportModule } from "@nestjs/passport";
import { AuthController } from "./auth.controller";
import { LocalStrategy } from "./local.strategy";
import { JwtModule } from "@nestjs/jwt";
import { ConfigModule } from "@nestjs/config";
import { ConfigService } from "@nestjs/config";
import { JwtStrategy } from "./jwt.strategy";
import { SettingsModule } from "src/settings/settings.module";
import { GoogleStrategy } from "./google.strategy";
import { HeaderApiKeyStrategy } from "./apikey.strategy";

@Module({
	imports: [
		ConfigModule,
		UsersModule,
		SettingsModule,
		PassportModule,
		JwtModule.registerAsync({
			imports: [ConfigModule],
			useFactory: async (configService: ConfigService) => ({
				secret: configService.get("JWT_SECRET"),
				signOptions: { expiresIn: "365d" },
			}),
			inject: [ConfigService],
		}),
	],
	providers: [
		AuthService,
		LocalStrategy,
		JwtStrategy,
		GoogleStrategy,
		HeaderApiKeyStrategy,
	],
	controllers: [AuthController],
})
export class AuthModule {}
