import { Module } from '@nestjs/common';
import { MenuActionsController } from './menu-actions.controller';
import { TypeOrmModule } from '@nestjs/typeorm';
import { JwtService } from '@nestjs/jwt';
import { MenuActionsService } from './menu-actions.service';
import { CacheModule } from '@nestjs/cache-manager';
import { MenuActionsEntity } from 'src/entities/MenuActions.entity';

/**
 * MenuActionsModule - Feature module for managing menu actions/operations
 *
 * This module encapsulates all components related to menu actions functionality:
 * - Controllers: Handle HTTP requests
 * - Services: Contain business logic
 * - Entities: Define database schema
 * - Repositories: Provide data access
 */
@Module({
  // Controllers define the API endpoints for this module
  controllers: [MenuActionsController],

  // Providers are services that can be injected throughout the module
  providers: [
    MenuActionsService, // Main service for menu actions business logic
    JwtService, // JWT service for token operations (authentication/authorization)
  ],

  // Imports bring external modules and their providers into this module
  imports: [
    // CacheModule provides caching functionality
    // .register() with no options uses default in-memory cache
    CacheModule.register(),

    // TypeOrmModule.forFeature() makes MenuActionsEntity repository available for injection
    // This creates a repository that can be injected using @InjectRepository()
    TypeOrmModule.forFeature([MenuActionsEntity]),
  ],

  // Note: No 'exports' array - this module's providers are only available within this module
  // If other modules need MenuActionsService or JwtService, they should import their own instances
})
export class MenuActionsModule {}
