from datetime import datetime
from typing import Optional

from core.typing import SerialId
from core.database.abc.db_model_abc import DbModelABC


class Permission(DbModelABC):
    def __init__(
        self,
        id: SerialId,
        name: str,
        description: str,
        deleted: bool = False,
        editor_id: Optional[SerialId] = None,
        created: Optional[datetime] = None,
        updated: Optional[datetime] = None,
    ):
        DbModelABC.__init__(self, id, deleted, editor_id, created, updated)
        self._name = name
        self._description = description

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

    @name.setter
    def name(self, value: str):
        self._name = value

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

    @description.setter
    def description(self, value: str):
        self._description = value
