import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { TypeOrmModule } from '@nestjs/typeorm';
import { DatabaseModule } from '@it0/database';

// Domain Entities
import { Notification } from './domain/entities/notification.entity';
import { NotificationRead } from './domain/entities/notification-read.entity';
import { NotificationTenantTarget } from './domain/entities/notification-tenant-target.entity';

// Infrastructure
import { NotificationRepository } from './infrastructure/repositories/notification.repository';
import { ChannelRepository } from './infrastructure/repositories/channel.repository';
import { CampaignRepository } from './infrastructure/repositories/campaign.repository';
import { SegmentRepository } from './infrastructure/repositories/segment.repository';

// Application Services
import { EventTriggerService } from './application/services/event-trigger.service';

// Controllers
import { NotificationAdminController } from './interfaces/rest/controllers/notification-admin.controller';
import { NotificationUserController } from './interfaces/rest/controllers/notification-user.controller';
import { NotificationChannelController } from './interfaces/rest/controllers/notification-channel.controller';
import { CampaignAdminController } from './interfaces/rest/controllers/campaign-admin.controller';
import { SegmentAdminController } from './interfaces/rest/controllers/segment-admin.controller';

@Module({
  imports: [
    ConfigModule.forRoot({ isGlobal: true }),
    DatabaseModule.forRoot(),
    TypeOrmModule.forFeature([Notification, NotificationRead, NotificationTenantTarget]),
  ],
  controllers: [
    NotificationAdminController,
    NotificationUserController,
    NotificationChannelController,
    CampaignAdminController,
    SegmentAdminController,
  ],
  providers: [
    NotificationRepository,
    ChannelRepository,
    CampaignRepository,
    SegmentRepository,
    EventTriggerService,
  ],
})
export class NotificationModule {}
