import { Module } from '@nestjs/common';

// Core
import { EntityEventsService } from './core/entity-events.service';
import { EntityRegistry } from './core/entity-registry';

// Services
import { PipelinesService } from './services/pipelines.service';
import { LostReasonsService } from './services/lost-reasons.service';
import { TimelineService } from './services/timeline.service';
import { ActivitiesService } from './services/activities.service';
import { UserFieldsService } from './services/user-fields.service';
import { CardLayoutService } from './services/card-layout.service';
import { FraudDetectionService } from './services/fraud-detection.service';
import { FieldDetectorService } from './services/field-detector.service';
import { WebhookProcessorService } from './services/webhook-processor.service';

// Entities
import { DealManager } from './entities/deal/deal.manager';
import { DealPermissions } from './entities/deal/deal.permissions';
import { DealEvents } from './entities/deal/deal.events';
import { TrainingManager } from './entities/training/training.manager';
import { TrainingPermissions } from './entities/training/training.permissions';

// Controllers
import { PipelinesController } from './controllers/pipelines.controller';
import { LostReasonsController } from './controllers/lost-reasons.controller';
import { DealsController } from './controllers/deals.controller';
import { TimelineController } from './controllers/timeline.controller';
import { ActivitiesController } from './controllers/activities.controller';
import { FieldsController } from './controllers/fields.controller';
import { CardLayoutsController } from './controllers/card-layouts.controller';
import {
  WebhooksPublicController,
  WebhooksAdminController,
} from './controllers/webhooks.controller';
import { TrainingsController } from './controllers/trainings.controller';

// Processors
import { CrmSchedulerProcessor } from './processors/crm-scheduler.processor';

@Module({
  imports: [],
  controllers: [
    PipelinesController,
    LostReasonsController,
    DealsController,
    TimelineController,
    ActivitiesController,
    FieldsController,
    CardLayoutsController,
    WebhooksPublicController,
    WebhooksAdminController,
    TrainingsController,
  ],
  providers: [
    // Core
    EntityEventsService,
    EntityRegistry,

    // Services
    PipelinesService,
    LostReasonsService,
    TimelineService,
    ActivitiesService,
    UserFieldsService,
    CardLayoutService,
    FraudDetectionService,
    FieldDetectorService,
    WebhookProcessorService,

    // Entities
    DealManager,
    DealPermissions,
    DealEvents,
    TrainingManager,
    TrainingPermissions,

    // Processors
    CrmSchedulerProcessor,
  ],
  exports: [
    DealManager,
    TrainingManager,
    PipelinesService,
    TimelineService,
    ActivitiesService,
    UserFieldsService,
    CardLayoutService,
    WebhookProcessorService,
    EntityEventsService,
    EntityRegistry,
  ],
})
export class CrmModule {}
