import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { CacheModule } from '@nestjs/cache-manager';
import { FranchisesService } from './franchises.service';
import { FranchisesController } from './franchises.controller';
import { Franchises } from './entities/franchises.entity';
import { UserEntity } from '../user/entities/user.entity';
import { Companies } from '../companies/entities/companies.entity';
import { AnalyticsModule } from '../analytics/analytics.module';
import { ReportsHistoryModule } from '../reports_history/reports_history.module';
import { ReportsHistory } from '../reports_history/entities/reports_history.entity';
import { JobPosts } from '../job_posts/entities/job_posts.entity';
import { JobApplications } from '../job_applications/entities/job_applications.entity';
import { JobViews } from '../job_views/entities/job_views.entity';
import { SeekerProfiles } from '../seeker_profiles/entities/seeker_profiles.entity';

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