# Copyright (c) 2019-2023 r3w0p
# The following code can be redistributed and/or
# modified under the terms of the MIT License.

"""
Producer publish-subscribe classes.
"""

from abc import ABC, abstractmethod

from bobocep.cep.event import BoboEventComplex


class BoboProducerSubscriber(ABC):
    """A producer subscriber interface."""

    @abstractmethod
    def on_producer_update(
            self,
            event: BoboEventComplex,
            local: bool
    ) -> None:
        """
        :param event: Complex event generated by Producer.
        :param local: `True` if the complex event was generated using
            a locally-completed run; `False` otherwise.
        """


class BoboProducerPublisher(ABC):
    """A producer publisher interface."""

    @abstractmethod
    def subscribe(self, subscriber: BoboProducerSubscriber):
        """
        :param subscriber: Subscriber to add to list.
        """
