import { Module } from '@nestjs/common';
import { HomeController } from './home.controller';
import { TypeOrmModule } from '@nestjs/typeorm';
import { JwtService } from '@nestjs/jwt';
import { HomeService } from './home.service';
import { CacheModule } from '@nestjs/cache-manager';
import { UspTextEntity } from 'src/entities/UspText.entity';
import { UspCountEntity } from 'src/entities/UspCount.entity';
import { UspTextDescriptionEntity } from 'src/entities/UspTextDescription.entity';
import { OffersEntity } from 'src/entities/Offers.entity';
import { WebBannerDetailsEntity } from 'src/entities/WebBannerDetails.entity';
import { CountryEntity } from 'src/entities/Country.entity';
import { StudentTestimonialTextEntity } from 'src/entities/StudentTestimonialText.entity';
import { AccoladesAndAssociationsEntity } from 'src/entities/AccoladesAndAssociations.entity';
import { WebMediaEntity } from 'src/entities/WebMedia.entity';
import { OurProductsEntity } from 'src/entities/OurProducts.entity';
import { TvShowsEntity } from 'src/entities/TvShows.entity';

/**
 * HomeModule - Module for homepage and public content management
 *
 * This module organizes all components related to public-facing content
 * including homepage features, marketing materials, testimonials, and media.
 *
 * Features:
 * - TypeORM integration for database entities
 * - Caching support for performance optimization
 * - JWT service for potential authenticated endpoints
 * - Comprehensive entity management for various content types
 *
 * @example
 * // Import into main AppModule
 * @Module({
 *   imports: [HomeModule, ...],
 * })
 * export class AppModule {}
 */
@Module({
  // HTTP controllers for public content endpoints
  controllers: [HomeController],

  // Service providers for business logic
  providers: [
    HomeService, // Main service for homepage content operations
    JwtService, // JWT service (useful if some endpoints need authentication)
  ],

  // Module imports for dependencies
  imports: [
    // Caching module for performance optimization
    // Public content benefits greatly from caching as it rarely changes
    CacheModule.register(),

    // Database integration with all required entities
    TypeOrmModule.forFeature([
      // Unique Selling Proposition content
      UspTextEntity, // USP text content
      UspCountEntity, // USP statistical counts
      UspTextDescriptionEntity, // USP detailed descriptions

      // Promotional content
      OffersEntity, // Special offers and promotions
      WebBannerDetailsEntity, // Website banner images/content

      // Reference data
      CountryEntity, // Country listings for selection

      // Social proof and credibility
      StudentTestimonialTextEntity, // Customer testimonials
      AccoladesAndAssociationsEntity, // Awards and association memberships

      // Media content
      WebMediaEntity, // General web media (images, videos)
      OurProductsEntity, // Product/service listings
      TvShowsEntity, // Video/TV show content
    ]),
  ],

  // Optional: Export services for use in other modules
  // exports: [HomeService],
})
export class HomeModule {}
