import { Module } from '@nestjs/common';
import { StudentController } from './student.controller';
import { TypeOrmModule } from '@nestjs/typeorm';
import { JwtService } from '@nestjs/jwt';
import { StudentService } from './student.service';
import { CacheModule } from '@nestjs/cache-manager';
import { StudentsEntity } from 'src/entities/Students.entity';

/**
 * StudentModule - Module for student management and authentication
 *
 * This module organizes all components related to student operations including
 * authentication, profile management, and student-specific functionality.
 * It provides a focused, cohesive unit for handling student-related concerns.
 *
 * Features:
 * - TypeORM integration for StudentsEntity
 * - Caching support for performance optimization
 * - JWT service for authentication token management
 * - Clean separation of student concerns from other user types
 *
 * @example
 * // Import into main AppModule
 * @Module({
 *   imports: [StudentModule, ...],
 * })
 * export class AppModule {}
 */
@Module({
  // HTTP controllers for student endpoints
  controllers: [StudentController],

  // Service providers for business logic
  providers: [
    StudentService, // Main service for student operations
    JwtService, // JWT service for token generation/verification
  ],

  // Module imports for dependencies
  imports: [
    // Caching module for performance optimization
    // Student data can be cached for read-heavy operations
    CacheModule.register(),

    // Database integration with student entity
    TypeOrmModule.forFeature([
      StudentsEntity, // Primary student data entity
      // Future entities could be added here:
      // StudentCoursesEntity,
      // StudentAttendanceEntity,
      // StudentGradesEntity,
    ]),
  ],

  // Optional: Export services for use in other modules
  // exports: [StudentService, JwtService],
})
export class StudentModule {}
