import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { ScheduleModule } from '@nestjs/schedule';

import { AggregatedMetric } from '../entities/aggregated-metric.entity';
import { DeletionAuditLog } from '../entities/deletion-audit-log.entity';

import { GdprService } from './gdpr.service';
import { GdprController } from './gdpr.controller';
import { DataRetentionService } from './data-retention.service';
import { DataRetentionCron } from './data-retention.cron';

/**
 * GdprModule - GDPR compliance module for analytics
 *
 * Provides:
 * - Data export (Article 15 - Right of Access)
 * - Data deletion (Article 17 - Right to Erasure)
 * - Data retention policies (Article 5(1)(e) - Storage Limitation)
 * - Audit logging for compliance verification
 *
 * This is a generic implementation. Platform-specific implementations
 * should extend this module with their own entities and deletion logic.
 */
@Module({
  imports: [
    ScheduleModule.forRoot(),
    TypeOrmModule.forFeature([AggregatedMetric, DeletionAuditLog]),
  ],
  controllers: [GdprController],
  providers: [GdprService, DataRetentionService, DataRetentionCron],
  exports: [GdprService, DataRetentionService],
})
export class GdprModule {}
