# 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 CoordsDict(TypedDict):
    x: int
    y: int


class Coords:
    def __init__(self, x: int, y: int):
        self.x: int = x
        self.y: int = y

    @classmethod
    def from_dict(cls, _d: CoordsDict | None) -> "Coords | None":
        if _d is None:
            return None
        return cls(
            x=_d["x"],
            y=_d["y"],
        )

    @staticmethod
    def validate(_d: CoordsDict) -> bool:
        return all(
            [
                "x" in _d and type(_d["x"]) is int,
                "y" in _d and type(_d["y"]) is int,
            ]
        )

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

        ret["x"] = self.x
        ret["y"] = self.y

        return ret
