from api_graphql.abc.input_abc import InputABC
from api_graphql.input.attachment_input import AttachmentInput


class NewsUpdateInput(InputABC):

    def __init__(self, src: dict):
        InputABC.__init__(self, src)

        self._id = self.option("id", int, required=True)
        self._title = self.option("title", str)
        self._content = self.option("content", str)
        self._published = self.option("published", bool, default=False)
        self._attachments = self.option(
            "attachments", list[AttachmentInput], default=[]
        )

    @property
    def id(self) -> int:
        return self._id

    @property
    def title(self) -> str:
        return self._title

    @property
    def content(self) -> str:
        return self._content

    @property
    def published(self) -> bool:
        return self._published

    @property
    def attachments(self) -> list[AttachmentInput]:
        return self._attachments
