from typing import TYPE_CHECKING
from event import Event

if TYPE_CHECKING:
    from environment import Environment


class Timeout(Event):
    """Event that succeeds after a delay in simulated time."""

    def __init__(self, env: "Environment", delay: float | int):
        assert delay >= 0
        super().__init__(env)
        env.schedule(env.now + delay, lambda: self.succeed())
