"""This is an automatically generated stub for `geo.capnp`."""

from __future__ import annotations

from collections.abc import Iterator
from contextlib import contextmanager
from enum import Enum
from io import BufferedWriter
from typing import Any, BinaryIO, Generic, Literal, TypeVar, overload

_CoordinateType = TypeVar("_CoordinateType")

class CoordType(Enum):
    gk = "gk"
    utm = "utm"
    latlon = "latlon"

class EPSG:
    wgs84: int
    utm21S: int
    utm32N: int
    gk5: int
    gk4: int
    gk3: int
    @staticmethod
    @contextmanager
    def from_bytes(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> Iterator[EPSGReader]: ...
    @staticmethod
    def from_bytes_packed(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> EPSGReader: ...
    @staticmethod
    def new_message(
        num_first_segment_words: int | None = None, allocate_seg_callable: Any = None
    ) -> EPSGBuilder: ...
    @staticmethod
    def read(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> EPSGReader: ...
    @staticmethod
    def read_packed(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> EPSGReader: ...
    def to_dict(self) -> dict[str, Any]: ...

class EPSGReader(EPSG):
    def as_builder(self) -> EPSGBuilder: ...

class EPSGBuilder(EPSG):
    @staticmethod
    def from_dict(dictionary: dict[str, Any]) -> EPSGBuilder: ...
    def copy(self) -> EPSGBuilder: ...
    def to_bytes(self) -> bytes: ...
    def to_bytes_packed(self) -> bytes: ...
    def to_segments(self) -> list[bytes]: ...
    def as_reader(self) -> EPSGReader: ...
    @staticmethod
    def write(file: BufferedWriter) -> None: ...
    @staticmethod
    def write_packed(file: BufferedWriter) -> None: ...

class UTMCoord:
    @property
    def zone(self) -> int: ...
    @property
    def latitudeBand(self) -> str: ...
    @property
    def r(self) -> float: ...
    @property
    def h(self) -> float: ...
    @staticmethod
    @contextmanager
    def from_bytes(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> Iterator[UTMCoordReader]: ...
    @staticmethod
    def from_bytes_packed(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> UTMCoordReader: ...
    @staticmethod
    def new_message(
        num_first_segment_words: int | None = None,
        allocate_seg_callable: Any = None,
        zone: int | None = None,
        latitudeBand: str | None = None,
        r: float | None = None,
        h: float | None = None,
    ) -> UTMCoordBuilder: ...
    @staticmethod
    def read(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> UTMCoordReader: ...
    @staticmethod
    def read_packed(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> UTMCoordReader: ...
    def to_dict(self) -> dict[str, Any]: ...

class UTMCoordReader(UTMCoord):
    def as_builder(self) -> UTMCoordBuilder: ...

class UTMCoordBuilder(UTMCoord):
    @property
    def zone(self) -> int: ...
    @zone.setter
    def zone(self, value: int) -> None: ...
    @property
    def latitudeBand(self) -> str: ...
    @latitudeBand.setter
    def latitudeBand(self, value: str) -> None: ...
    @property
    def r(self) -> float: ...
    @r.setter
    def r(self, value: float) -> None: ...
    @property
    def h(self) -> float: ...
    @h.setter
    def h(self, value: float) -> None: ...
    @staticmethod
    def from_dict(dictionary: dict[str, Any]) -> UTMCoordBuilder: ...
    def copy(self) -> UTMCoordBuilder: ...
    def to_bytes(self) -> bytes: ...
    def to_bytes_packed(self) -> bytes: ...
    def to_segments(self) -> list[bytes]: ...
    def as_reader(self) -> UTMCoordReader: ...
    @staticmethod
    def write(file: BufferedWriter) -> None: ...
    @staticmethod
    def write_packed(file: BufferedWriter) -> None: ...

class LatLonCoord:
    @property
    def lat(self) -> float: ...
    @property
    def lon(self) -> float: ...
    @staticmethod
    @contextmanager
    def from_bytes(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> Iterator[LatLonCoordReader]: ...
    @staticmethod
    def from_bytes_packed(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> LatLonCoordReader: ...
    @staticmethod
    def new_message(
        num_first_segment_words: int | None = None,
        allocate_seg_callable: Any = None,
        lat: float | None = None,
        lon: float | None = None,
    ) -> LatLonCoordBuilder: ...
    @staticmethod
    def read(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> LatLonCoordReader: ...
    @staticmethod
    def read_packed(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> LatLonCoordReader: ...
    def to_dict(self) -> dict[str, Any]: ...

class LatLonCoordReader(LatLonCoord):
    def as_builder(self) -> LatLonCoordBuilder: ...

class LatLonCoordBuilder(LatLonCoord):
    @property
    def lat(self) -> float: ...
    @lat.setter
    def lat(self, value: float) -> None: ...
    @property
    def lon(self) -> float: ...
    @lon.setter
    def lon(self, value: float) -> None: ...
    @staticmethod
    def from_dict(dictionary: dict[str, Any]) -> LatLonCoordBuilder: ...
    def copy(self) -> LatLonCoordBuilder: ...
    def to_bytes(self) -> bytes: ...
    def to_bytes_packed(self) -> bytes: ...
    def to_segments(self) -> list[bytes]: ...
    def as_reader(self) -> LatLonCoordReader: ...
    @staticmethod
    def write(file: BufferedWriter) -> None: ...
    @staticmethod
    def write_packed(file: BufferedWriter) -> None: ...

class GKCoord:
    @property
    def meridianNo(self) -> int: ...
    @property
    def r(self) -> float: ...
    @property
    def h(self) -> float: ...
    @staticmethod
    @contextmanager
    def from_bytes(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> Iterator[GKCoordReader]: ...
    @staticmethod
    def from_bytes_packed(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> GKCoordReader: ...
    @staticmethod
    def new_message(
        num_first_segment_words: int | None = None,
        allocate_seg_callable: Any = None,
        meridianNo: int | None = None,
        r: float | None = None,
        h: float | None = None,
    ) -> GKCoordBuilder: ...
    @staticmethod
    def read(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> GKCoordReader: ...
    @staticmethod
    def read_packed(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> GKCoordReader: ...
    def to_dict(self) -> dict[str, Any]: ...

class GKCoordReader(GKCoord):
    def as_builder(self) -> GKCoordBuilder: ...

class GKCoordBuilder(GKCoord):
    @property
    def meridianNo(self) -> int: ...
    @meridianNo.setter
    def meridianNo(self, value: int) -> None: ...
    @property
    def r(self) -> float: ...
    @r.setter
    def r(self, value: float) -> None: ...
    @property
    def h(self) -> float: ...
    @h.setter
    def h(self, value: float) -> None: ...
    @staticmethod
    def from_dict(dictionary: dict[str, Any]) -> GKCoordBuilder: ...
    def copy(self) -> GKCoordBuilder: ...
    def to_bytes(self) -> bytes: ...
    def to_bytes_packed(self) -> bytes: ...
    def to_segments(self) -> list[bytes]: ...
    def as_reader(self) -> GKCoordReader: ...
    @staticmethod
    def write(file: BufferedWriter) -> None: ...
    @staticmethod
    def write_packed(file: BufferedWriter) -> None: ...

class Point2D:
    @property
    def x(self) -> float: ...
    @property
    def y(self) -> float: ...
    @staticmethod
    @contextmanager
    def from_bytes(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> Iterator[Point2DReader]: ...
    @staticmethod
    def from_bytes_packed(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> Point2DReader: ...
    @staticmethod
    def new_message(
        num_first_segment_words: int | None = None,
        allocate_seg_callable: Any = None,
        x: float | None = None,
        y: float | None = None,
    ) -> Point2DBuilder: ...
    @staticmethod
    def read(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> Point2DReader: ...
    @staticmethod
    def read_packed(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> Point2DReader: ...
    def to_dict(self) -> dict[str, Any]: ...

class Point2DReader(Point2D):
    def as_builder(self) -> Point2DBuilder: ...

class Point2DBuilder(Point2D):
    @property
    def x(self) -> float: ...
    @x.setter
    def x(self, value: float) -> None: ...
    @property
    def y(self) -> float: ...
    @y.setter
    def y(self, value: float) -> None: ...
    @staticmethod
    def from_dict(dictionary: dict[str, Any]) -> Point2DBuilder: ...
    def copy(self) -> Point2DBuilder: ...
    def to_bytes(self) -> bytes: ...
    def to_bytes_packed(self) -> bytes: ...
    def to_segments(self) -> list[bytes]: ...
    def as_reader(self) -> Point2DReader: ...
    @staticmethod
    def write(file: BufferedWriter) -> None: ...
    @staticmethod
    def write_packed(file: BufferedWriter) -> None: ...

class RowCol:
    @property
    def row(self) -> int: ...
    @property
    def col(self) -> int: ...
    @staticmethod
    @contextmanager
    def from_bytes(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> Iterator[RowColReader]: ...
    @staticmethod
    def from_bytes_packed(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> RowColReader: ...
    @staticmethod
    def new_message(
        num_first_segment_words: int | None = None,
        allocate_seg_callable: Any = None,
        row: int | None = None,
        col: int | None = None,
    ) -> RowColBuilder: ...
    @staticmethod
    def read(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> RowColReader: ...
    @staticmethod
    def read_packed(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> RowColReader: ...
    def to_dict(self) -> dict[str, Any]: ...

class RowColReader(RowCol):
    def as_builder(self) -> RowColBuilder: ...

class RowColBuilder(RowCol):
    @property
    def row(self) -> int: ...
    @row.setter
    def row(self, value: int) -> None: ...
    @property
    def col(self) -> int: ...
    @col.setter
    def col(self, value: int) -> None: ...
    @staticmethod
    def from_dict(dictionary: dict[str, Any]) -> RowColBuilder: ...
    def copy(self) -> RowColBuilder: ...
    def to_bytes(self) -> bytes: ...
    def to_bytes_packed(self) -> bytes: ...
    def to_segments(self) -> list[bytes]: ...
    def as_reader(self) -> RowColReader: ...
    @staticmethod
    def write(file: BufferedWriter) -> None: ...
    @staticmethod
    def write_packed(file: BufferedWriter) -> None: ...

class Coord:
    @property
    def gk(self) -> GKCoord: ...
    @property
    def latlon(self) -> LatLonCoord: ...
    @property
    def utm(self) -> UTMCoord: ...
    @property
    def p2D(self) -> Point2D: ...
    @property
    def rowcol(self) -> RowCol: ...
    def which(self) -> Literal["gk", "latlon", "utm", "p2D", "rowcol"]: ...
    @overload
    def init(self, name: Literal["gk"]) -> GKCoord: ...
    @overload
    def init(self, name: Literal["latlon"]) -> LatLonCoord: ...
    @overload
    def init(self, name: Literal["utm"]) -> UTMCoord: ...
    @overload
    def init(self, name: Literal["p2D"]) -> Point2D: ...
    @overload
    def init(self, name: Literal["rowcol"]) -> RowCol: ...
    def init(self: Any, name: str, size: int = ...) -> Any: ...
    @staticmethod
    @contextmanager
    def from_bytes(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> Iterator[CoordReader]: ...
    @staticmethod
    def from_bytes_packed(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> CoordReader: ...
    @staticmethod
    def new_message(
        num_first_segment_words: int | None = None,
        allocate_seg_callable: Any = None,
        gk: GKCoordBuilder | dict[str, Any] | None = None,
        latlon: LatLonCoordBuilder | dict[str, Any] | None = None,
        utm: UTMCoordBuilder | dict[str, Any] | None = None,
        p2D: Point2DBuilder | dict[str, Any] | None = None,
        rowcol: RowColBuilder | dict[str, Any] | None = None,
    ) -> CoordBuilder: ...
    @staticmethod
    def read(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> CoordReader: ...
    @staticmethod
    def read_packed(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> CoordReader: ...
    def to_dict(self) -> dict[str, Any]: ...

class CoordReader(Coord):
    @property
    def gk(self) -> GKCoordReader: ...
    @property
    def latlon(self) -> LatLonCoordReader: ...
    @property
    def utm(self) -> UTMCoordReader: ...
    @property
    def p2D(self) -> Point2DReader: ...
    @property
    def rowcol(self) -> RowColReader: ...
    def as_builder(self) -> CoordBuilder: ...

class CoordBuilder(Coord):
    @property
    def gk(self) -> GKCoordBuilder: ...
    @gk.setter
    def gk(
        self, value: GKCoord | GKCoordBuilder | GKCoordReader | dict[str, Any]
    ) -> None: ...
    @property
    def latlon(self) -> LatLonCoordBuilder: ...
    @latlon.setter
    def latlon(
        self,
        value: LatLonCoord | LatLonCoordBuilder | LatLonCoordReader | dict[str, Any],
    ) -> None: ...
    @property
    def utm(self) -> UTMCoordBuilder: ...
    @utm.setter
    def utm(
        self, value: UTMCoord | UTMCoordBuilder | UTMCoordReader | dict[str, Any]
    ) -> None: ...
    @property
    def p2D(self) -> Point2DBuilder: ...
    @p2D.setter
    def p2D(
        self, value: Point2D | Point2DBuilder | Point2DReader | dict[str, Any]
    ) -> None: ...
    @property
    def rowcol(self) -> RowColBuilder: ...
    @rowcol.setter
    def rowcol(
        self, value: RowCol | RowColBuilder | RowColReader | dict[str, Any]
    ) -> None: ...
    @staticmethod
    def from_dict(dictionary: dict[str, Any]) -> CoordBuilder: ...
    @overload
    def init(self: Any, name: Literal["gk"]) -> GKCoordBuilder: ...
    @overload
    def init(self: Any, name: Literal["latlon"]) -> LatLonCoordBuilder: ...
    @overload
    def init(self: Any, name: Literal["utm"]) -> UTMCoordBuilder: ...
    @overload
    def init(self: Any, name: Literal["p2D"]) -> Point2DBuilder: ...
    @overload
    def init(self: Any, name: Literal["rowcol"]) -> RowColBuilder: ...
    def init(self: Any, name: str, size: int = ...) -> Any: ...
    def copy(self) -> CoordBuilder: ...
    def to_bytes(self) -> bytes: ...
    def to_bytes_packed(self) -> bytes: ...
    def to_segments(self) -> list[bytes]: ...
    def as_reader(self) -> CoordReader: ...
    @staticmethod
    def write(file: BufferedWriter) -> None: ...
    @staticmethod
    def write_packed(file: BufferedWriter) -> None: ...

class RectBounds(Generic[_CoordinateType]):
    @property
    def tl(self) -> _CoordinateType: ...
    @property
    def br(self) -> _CoordinateType: ...
    @staticmethod
    @contextmanager
    def from_bytes(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> Iterator[RectBoundsReader]: ...
    @staticmethod
    def from_bytes_packed(
        data: bytes,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> RectBoundsReader: ...
    @staticmethod
    def new_message(
        num_first_segment_words: int | None = None,
        allocate_seg_callable: Any = None,
        tl: _CoordinateType | None = None,
        br: _CoordinateType | None = None,
    ) -> RectBoundsBuilder: ...
    @staticmethod
    def read(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> RectBoundsReader: ...
    @staticmethod
    def read_packed(
        file: BinaryIO,
        traversal_limit_in_words: int | None = ...,
        nesting_limit: int | None = ...,
    ) -> RectBoundsReader: ...
    def to_dict(self) -> dict[str, Any]: ...

class RectBoundsReader(RectBounds, Generic[_CoordinateType]):
    def as_builder(self) -> RectBoundsBuilder: ...

class RectBoundsBuilder(RectBounds, Generic[_CoordinateType]):
    @property
    def tl(self) -> _CoordinateType: ...
    @tl.setter
    def tl(self, value: _CoordinateType) -> None: ...
    @property
    def br(self) -> _CoordinateType: ...
    @br.setter
    def br(self, value: _CoordinateType) -> None: ...
    @staticmethod
    def from_dict(dictionary: dict[str, Any]) -> RectBoundsBuilder: ...
    def copy(self) -> RectBoundsBuilder: ...
    def to_bytes(self) -> bytes: ...
    def to_bytes_packed(self) -> bytes: ...
    def to_segments(self) -> list[bytes]: ...
    def as_reader(self) -> RectBoundsReader: ...
    @staticmethod
    def write(file: BufferedWriter) -> None: ...
    @staticmethod
    def write_packed(file: BufferedWriter) -> None: ...
