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

// Core
import { AvailabilityService } from './core/availability.service';
import { BookingEventsService } from './core/booking-events.service';
import { BookingPermissions } from './core/booking-permissions';

// Services
import { BookingServicesService } from './services/booking-services.service';
import { StaffScheduleService } from './services/staff-schedule.service';
import { BookingRecordsService } from './services/records.service';
import { GroupEventsService } from './services/group-events.service';
import { WaitlistService } from './services/waitlist.service';

// Sprint 3: Integrations
import { WebhookDispatcherService } from './services/webhook-dispatcher.service';
import { CrmBridgeService } from './services/crm-bridge.service';
import { BookingNotificationService } from './services/booking-notification.service';
import { BookingWebhookProcessor } from './processors/webhook.processor';
import { Bitrix24Adapter } from './adapters/bitrix24.adapter';
import { OneCAdapter } from './adapters/onec.adapter';

// Sprint 4: Memberships & Payments
import { MembershipsService } from './services/memberships.service';
import { ClientMembershipsService } from './services/client-memberships.service';
import { PaymentService } from './services/payment.service';

// Sprint 5: Public API & Widget
import { WidgetSettingsService } from './services/widget-settings.service';

// Sprint 7: Analytics & Caching
import { BookingAnalyticsService } from './services/analytics.service';
import { AvailabilityCacheService } from './services/availability-cache.service';

// Controllers
import {
  BookingServicesController,
  BookingServiceCategoriesController,
} from './controllers/services.controller';
import { BookingScheduleController } from './controllers/schedule.controller';
import { BookingRecordsController } from './controllers/records.controller';
import { BookingGroupEventsController } from './controllers/group-events.controller';
import { BookingWaitlistController } from './controllers/waitlist.controller';
import { BookingAvailabilityController } from './controllers/availability.controller';
import { BookingWebhooksController } from './controllers/webhooks.controller';
import {
  BookingMembershipTypesController,
  BookingClientMembershipsController,
} from './controllers/memberships.controller';
import { BookingPaymentsController } from './controllers/payments.controller';
import { BookingPublicController } from './controllers/public.controller';
import { BookingWidgetSettingsController } from './controllers/widget-settings.controller';
import { BookingAnalyticsController } from './controllers/analytics.controller';

@Module({
  controllers: [
    BookingServicesController,
    BookingServiceCategoriesController,
    BookingScheduleController,
    BookingRecordsController,
    BookingGroupEventsController,
    BookingWaitlistController,
    BookingAvailabilityController,
    BookingWebhooksController,
    // Sprint 4
    BookingMembershipTypesController,
    BookingClientMembershipsController,
    BookingPaymentsController,
    // Sprint 5
    BookingPublicController,
    BookingWidgetSettingsController,
    // Sprint 7
    BookingAnalyticsController,
  ],
  providers: [
    // Core
    AvailabilityService,
    BookingEventsService,
    BookingPermissions,
    // Services
    BookingServicesService,
    StaffScheduleService,
    BookingRecordsService,
    GroupEventsService,
    WaitlistService,
    // Integrations (Sprint 3)
    WebhookDispatcherService,
    CrmBridgeService,
    BookingNotificationService,
    BookingWebhookProcessor,
    Bitrix24Adapter,
    OneCAdapter,
    // Memberships & Payments (Sprint 4)
    MembershipsService,
    ClientMembershipsService,
    PaymentService,
    // Public API & Widget (Sprint 5)
    WidgetSettingsService,
    // Analytics & Caching (Sprint 7)
    BookingAnalyticsService,
    AvailabilityCacheService,
  ],
  exports: [
    AvailabilityService,
    BookingEventsService,
    BookingPermissions,
    BookingServicesService,
    StaffScheduleService,
    BookingRecordsService,
    GroupEventsService,
    WaitlistService,
    WebhookDispatcherService,
    CrmBridgeService,
    MembershipsService,
    ClientMembershipsService,
    PaymentService,
    WidgetSettingsService,
    BookingAnalyticsService,
    AvailabilityCacheService,
  ],
})
export class BookingModule {}
