# DO NOT EDIT!
# This code was auto generated by the `protoc-gen-pokete-resources-python` plugin,
# part of the pokete project, by <lxgr@protonmail.com>
from typing import TypedDict


class AchievementDict(TypedDict):
    title: str
    desc: str


class Achievement:
    def __init__(self, title: str, desc: str):
        self.title: str = title
        self.desc: str = desc

    @classmethod
    def from_dict(cls, _d: AchievementDict | None) -> "Achievement | None":
        if _d is None:
            return None
        return cls(
            title=_d["title"],
            desc=_d["desc"],
        )

    @staticmethod
    def validate(_d: AchievementDict) -> bool:
        return all(
            [
                "title" in _d and type(_d["title"]) is str,
                "desc" in _d and type(_d["desc"]) is str,
            ]
        )

    def to_dict(self) -> AchievementDict:
        ret: AchievementDict = {}

        ret["title"] = self.title
        ret["desc"] = self.desc

        return ret
