from typing import List

from . import EventPublishDetail
from ._NewEventListener import NewEventListener


class NewEventTopic(object):
    def __init__(self):
        self.listeners: List[NewEventListener] = []

    def add_listener(self, listener: NewEventListener):
        self.listeners.append(listener)

    def notify(self, publish_detail: EventPublishDetail):
        for listener in self.listeners:
            listener.new_event(publish_detail=publish_detail)
