from zope.interface import Attribute
from zope.interface import Interface


class INotificationsQueues(Interface):
    """Stores queues for notifications for each user.

    Obsolete interface for the notification queues.
    """


class INotificationsTool(INotificationsQueues):
    """Provide INotificationsQueue as a site utility For package internal use
    only."""


class IChannel(Interface):
    """Obsolete interface for the notification channels."""


class IMessage(Interface):
    """Represents a notification message for a specific user."""

    recipient = Attribute("User id of the recipient of the message.")

    def mark_as_read(now=None):
        """Mark the message as read.

        if ``now`` is provided, it is assumed as an utc timestamp and
        stored
        """

    def marked_read_at():
        """Return when the message has been read as an utc time stamp."""

    def is_unread(self):
        """Return whether the message is unread."""

    def clone(self):
        """Return a clone of the message."""

    def update_object(self, obj):
        """Update the object.

        Forces an update of the ``message_last_modification_date`` which
        is stored on the object
        """

    def update_actors(self, added=[], removed=[]):
        """Update the actors list."""


class IMessageFactory(Interface):
    """Creates a message."""


class ILoggedEvent(Interface):
    """Represents a SQL logged event."""


class IProvideContextUID(Interface):
    """Adapter that converts the context to a UID
    that will be stored in the logged_event table."""


class IResolveContextUID(Interface):
    """Named utility that converts the UID stored in the logged_event table
    in to an object."""


class ICategory(Interface):
    """Provides the notification category."""


class ICategoryProvider(Interface):
    """Provides the categories interesting for an object."""


class IAggregatedNotifications(Interface):
    """Represents a set of notifications that are going to be aggregated
    together.
    """

    recipient_id = Attribute(
        "The id of the user that is going to get the notifications"
    )

    notifications = Attribute("The notifications that are going to be aggregated")
