from pathlib import PurePath
from typing import Optional


class TaskList:
    """Handle for a task list as returned and accepted by the API."""

    def __init__(self, href: PurePath, name: Optional[str], color: Optional[str]) -> None:
        self._href: PurePath = href
        self._name: Optional[str] = name
        self._color: Optional[str] = color

    @property
    def href(self) -> PurePath:
        return self._href

    @property
    def name(self) -> Optional[str]:
        return self._name

    @name.setter
    def name(self, name: str) -> None:
        self._name = name

    @property
    def color(self) -> Optional[str]:
        return self._color

    @color.setter
    def color(self, color: str) -> None:
        self._color = color


class TaskFile:
    """Handle for a task as returned and accepted by the API."""

    def __init__(self, href: PurePath, etag: Optional[str], content: str) -> None:
        self._href: PurePath = href
        self._etag: Optional[str] = etag
        self._content: str = content

    @property
    def href(self) -> PurePath:
        return self._href

    @property
    def etag(self) -> Optional[str]:
        """The originally retrieved version."""
        return self._etag

    @property
    def content(self) -> str:
        """vCalendar/vEvent/iCal payload to be parsed."""
        return self._content

    @content.setter
    def content(self, content: str) -> None:
        self._content = content