# 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 NatureDict(TypedDict):
    esc: str | None
    atc: float | None
    def_: float | None
    init: float | None


class Nature:
    def __init__(
        self, esc: str | None, atc: float | None, def_: float | None, init: float | None
    ):
        self.esc: str | None = esc
        self.atc: float | None = atc
        self.def_: float | None = def_
        self.init: float | None = init

    @classmethod
    def from_dict(cls, _d: NatureDict | None) -> "Nature | None":
        if _d is None:
            return None
        return cls(
            esc=_d.get("esc", None),
            atc=_d.get("atc", None),
            def_=_d.get("def_", None),
            init=_d.get("init", None),
        )

    @staticmethod
    def validate(_d: NatureDict) -> bool:
        return all(
            [
                type(_d.get("esc", None)) is str or _d.get("esc", None) is None,
                type(_d.get("atc", None)) is float
                or type(_d.get("atc", None)) is int
                or _d.get("atc", None) is None,
                type(_d.get("def_", None)) is float
                or type(_d.get("def_", None)) is int
                or _d.get("def_", None) is None,
                type(_d.get("init", None)) is float
                or type(_d.get("init", None)) is int
                or _d.get("init", None) is None,
            ]
        )

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

        if self.esc is not None:
            ret["esc"] = self.esc
        if self.atc is not None:
            ret["atc"] = self.atc
        if self.def_ is not None:
            ret["def_"] = self.def_
        if self.init is not None:
            ret["init"] = self.init

        return ret
