import { Global, Module } from "@nestjs/common";
import { CacheService } from "./cache.service.js";
import { DistributedLockService } from "./distributed-lock.service.js";
import { CacheCoordinatorService } from "./cache-coordinator.service.js";

/**
 * Global cache module
 *
 * Provides Redis-backed caching infrastructure for the entire application.
 * Exports:
 * - CacheService: Core Redis operations (get, set, del, delPattern)
 * - DistributedLockService: Distributed locking for concurrent operations
 * - CacheCoordinatorService: Utility for coordinating multi-cache invalidations
 */
@Global()
@Module({
  providers: [CacheService, DistributedLockService, CacheCoordinatorService],
  exports: [CacheService, DistributedLockService, CacheCoordinatorService],
})
export class CacheModule {}

// Export shared types for domain-specific cache services
export * from "./cache.types.js";
export { CacheCoordinatorService } from "./cache-coordinator.service.js";
