from typing import Optional

from api_graphql.abc.input_abc import InputABC
from data.schemas.permission.permission import Permission


class RoleCreateInput(InputABC):

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

        self._name = self.option("name", str, required=True)
        self._description = self.option("description", str)
        self._permissions = self.option("permissions", list[int], default=[])

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

    @property
    def description(self) -> Optional[str]:
        return self._description

    @property
    def permissions(self) -> list[int]:
        return self._permissions
