import { Module } from "@nestjs/common";
import { MongooseModule } from "@nestjs/mongoose";
import { ProgressController } from "./progress.controller";
import { ProgressService } from "./progress.service";
import { ResponseService } from "src/common/service/response.service";
import { TranslationService } from "src/common/service/translation.service";
import { JwtUtilsService } from "src/common/service/jwt.util.service";
import { User, UserSchema } from "src/user/schemas/user.schema";
import { TrainingPlan, TrainingPlanSchema } from "src/training-plan/schemas/training-plan.schema";
import { Performance, PerformanceSchema } from "src/performance/schemas/performance.schema";
import { MacroLog, MacroLogSchema } from "src/macros/schemas/macro.schema";
import { MacroTarget, MacroTargetSchema } from "src/macros/schemas/target-macro.schema";
import { WeightLog, WeightLogSchema } from "src/weight/schemas/weight.schema";
import {
  Challenges,
  ChallengesSchema,
} from "src/challenges/schemas/challenges.schema";
import {
  ChallengesUser,
  ChallengesUserSchema,
} from "src/challenges/schemas/challengesUser.schema";
import { StrengthModule } from "src/strength/strength.module";
import { WorkoutSessionModule } from "src/workout-session/workout-session.module";
import { ChallengesModule } from "src/challenges/challenges.module";

@Module({
  controllers: [ProgressController],
  providers: [ProgressService, ResponseService, TranslationService, JwtUtilsService],
  imports: [
    StrengthModule,
    WorkoutSessionModule,
    // provides AchievementsService (achievements collection owner)
    ChallengesModule,
    MongooseModule.forFeature([
      { name: User.name,          schema: UserSchema          },
      { name: TrainingPlan.name,  schema: TrainingPlanSchema  },
      { name: Performance.name,   schema: PerformanceSchema   },
      { name: MacroLog.name,      schema: MacroLogSchema      },
      { name: MacroTarget.name,   schema: MacroTargetSchema   },
      { name: WeightLog.name,     schema: WeightLogSchema     },
      { name: Challenges.name,     schema: ChallengesSchema     },
      { name: ChallengesUser.name, schema: ChallengesUserSchema },
    ]),
  ],
})
export class ProgressModule {}
