from datetime import (
    datetime,
    timedelta,
)

from ._SleepDateIterator import SleepDateIterator


class TimeDeltaDateIterator(SleepDateIterator):
    def __init__(self, initial_value: datetime, step: timedelta):
        self.initial_value = initial_value
        self.step = step

        self.current_value = self.initial_value

    def __next__(self):
        value = self.current_value
        self.current_value += self.step
        return value

    def sleep_for(self, seconds: float):
        self.current_value += timedelta(seconds=seconds)
