import { Module } from '@nestjs/common';
import { ScheduleModule } from '@nestjs/schedule';
import { InfrastructureModule } from '../infrastructure/infrastructure.module';

// Event Handlers
import { UserSyncedHandler } from './event-handlers/user-synced.handler';
import { ReferralSyncedHandler } from './event-handlers/referral-synced.handler';
import { AdoptionSyncedHandler } from './event-handlers/adoption-synced.handler';
import { CDCEventDispatcher } from './event-handlers/cdc-event-dispatcher';

// Services
import { ContributionCalculationService } from './services/contribution-calculation.service';
import { SnapshotService } from './services/snapshot.service';

// Queries
import { GetContributionAccountQuery } from './queries/get-contribution-account.query';
import { GetContributionStatsQuery } from './queries/get-contribution-stats.query';
import { GetContributionRankingQuery } from './queries/get-contribution-ranking.query';

// Schedulers
import { ContributionScheduler } from './schedulers/contribution.scheduler';

@Module({
  imports: [
    ScheduleModule.forRoot(),
    InfrastructureModule,
  ],
  providers: [
    // Event Handlers
    UserSyncedHandler,
    ReferralSyncedHandler,
    AdoptionSyncedHandler,
    CDCEventDispatcher,

    // Services
    ContributionCalculationService,
    SnapshotService,

    // Queries
    GetContributionAccountQuery,
    GetContributionStatsQuery,
    GetContributionRankingQuery,

    // Schedulers
    ContributionScheduler,
  ],
  exports: [
    ContributionCalculationService,
    SnapshotService,
    GetContributionAccountQuery,
    GetContributionStatsQuery,
    GetContributionRankingQuery,
  ],
})
export class ApplicationModule {}
