import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { CacheModule } from '@nestjs/cache-manager';
import { AnalyticsController } from './analytics.controller';
import { AnalyticsService } from './analytics.service';
import { JobPosts } from '../job_posts/entities/job_posts.entity';
import { JobApplications } from '../job_applications/entities/job_applications.entity';
import { Companies } from '../companies/entities/companies.entity';
import { UserEntity } from '../user/entities/user.entity';
import { JobViews } from '../job_views/entities/job_views.entity';
import { SeekerProfiles } from '../seeker_profiles/entities/seeker_profiles.entity';
import { City } from '../city/entities/city.entity';
import { Associates } from '../associates/entities/associates.entity';

@Module({
  imports: [
    TypeOrmModule.forFeature([
      JobPosts,
      JobApplications,
      Companies,
      UserEntity,
      JobViews,
      SeekerProfiles,
      City,
      Associates,
    ]),
    CacheModule.register({
      ttl: 300000, // 5 minutes
      max: 100, // maximum number of items in cache
    }),
  ],
  controllers: [AnalyticsController],
  providers: [AnalyticsService],
  exports: [AnalyticsService],
})
export class AnalyticsModule {}
