from abc import abstractmethod, ABCMeta
from typing import Iterable

from model.event_dispatch import EventDispatch


class EventDispatcherService(object):
    __metaclass__ = ABCMeta

    @abstractmethod
    def dispatch_event(self, event_to_dispatch):
        # type: (EventDispatch) -> None
        raise NotImplementedError()

    def dispatch_events(self, events_to_dispatch):
        # type: (Iterable[EventDispatch]) -> None
        for e in events_to_dispatch:
            self.dispatch_event(e)
