"""Provide the Front class."""
from typing import TYPE_CHECKING, Dict, Iterator, List, Union

from ..const import API_PATH
from .base import PRAWBase
from .listing.generator import ListingGenerator
from .util import stream_generator

if TYPE_CHECKING:  # pragma: no cover
    import praw


class Inbox(PRAWBase):
    """Inbox is a Listing class that represents the inbox."""

    def all(
        self, **generator_kwargs: Union[str, int, Dict[str, str]]
    ) -> Iterator[Union["praw.models.Message", "praw.models.Comment"]]:
        """Return a :class:`.ListingGenerator` for all inbox comments and messages.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.

        To output the type and ID of all items available via this listing do:

        .. code-block:: python

            for item in reddit.inbox.all(limit=None):
                print(repr(item))

        """
        return ListingGenerator(self._reddit, API_PATH["inbox"], **generator_kwargs)

    def collapse(self, items: List["praw.models.Message"]):
        """Mark an inbox message as collapsed.

        :param items: A list containing instances of :class:`.Message`.

        Requests are batched at 25 items (reddit limit).

        For example, to collapse all unread Messages, try:

        .. code-block:: python