import 'dart:async';

/// Abstract interface for time operations to enable controllable time in tests
abstract class ITimeProvider {
  /// Get current date and time
  DateTime now();
  
  /// Create a periodic timer
  Timer periodic(Duration duration, void Function(Timer) callback);
  
  /// Create a one-time timer
  Timer timer(Duration duration, void Function() callback);
}

/// Production implementation of ITimeProvider
class SystemTimeProvider implements ITimeProvider {
  @override
  DateTime now() => DateTime.now();
  
  @override
  Timer periodic(Duration duration, void Function(Timer) callback) {
    return Timer.periodic(duration, callback);
  }
  
  @override
  Timer timer(Duration duration, void Function() callback) {
    return Timer(duration, callback);
  }
}
