from typing import Sequence, Optional

from pyexlatex.models.item import NoOptionsNoContentsItem


class TableOfContents(NoOptionsNoContentsItem):
    name = 'tableofcontents'

    def __init__(self, options: Optional[Sequence[str]] = ('currentsection',), **kwargs):
        self.options = options
        super().__init__(self.name, modifiers=self.options_str, **kwargs)

    @property
    def options_str(self) -> str:
        options_str = ', '.join(self.options)
        return self._wrap_with_bracket(options_str)
