# nanobind stubgen pattern file for the compiled `_pgl` module.
#
# The stub is generated from the *bare* compiled module, before the Python sugar
# in pypgl/__init__.py runs, so that layer's additions are missing from the raw
# stub. That sugar makes every shape iterable/indexable over its defining points
# (`len(shape)`, `shape[i]`, `for p in shape`) and maps `point in shape` to
# `shape.contains(point)`. We re-declare it here so the shipped stub matches the
# runtime API. (Generating from the bare module also avoids a stubgen quirk where
# the runtime-patched lambdas leak in as an invalid `from pypgl import <lambda>`.)

# Point is indexed/iterated over its two rational coordinates.
Point\.__suffix__:
    \from collections.abc import Iterator
    def __len__(self) -> int: ...
    def __getitem__(self, index: int) -> fractions.Fraction: ...
    def __iter__(self) -> Iterator[fractions.Fraction]: ...
    def __contains__(self, point: Point) -> bool: ...

# Canvas, Triangulation, ShapeTree, BitMatrix, IntervalTree, Graph, the four
# Arrangement classes, the three arrangement handle types, Transformation,
# Text, and the two enums TextFit and GridAdjacency have no point sugar
# (none of them is a fixed-extent shape -- see pypgl/__init__.py); shield them
# from the generic shape rule below (an empty replacement suppresses any
# addition). The container ones bind their own __len__/__iter__/__contains__ in
# C++, over what they actually hold -- for a BitMatrix, its set cells.
Canvas\.__suffix__:

Triangulation\.__suffix__:

ShapeTree\.__suffix__:

BitMatrix\.__suffix__:

IntervalTree\.__suffix__:

IntervalTreeY\.__suffix__:

Graph\.__suffix__:

ArrangementGraph\.__suffix__:

Arrangement\.__suffix__:

PointListArrangement\.__suffix__:

DiskArrangement\.__suffix__:

DiskListArrangement\.__suffix__:

VertexId\.__suffix__:

HalfedgeId\.__suffix__:

FaceId\.__suffix__:

Transformation\.__suffix__:

Text\.__suffix__:

TextFit\.__suffix__:

GridAdjacency\.__suffix__:

# HalfplaneIntersection is indexed/iterated over its stored *half-planes*, not
# over points -- those are what pgl gives it size()/get()/index() for, its own
# corners being implicit. Must precede the generic rule below, which would
# otherwise claim it and promise Point.
HalfplaneIntersection\.__suffix__:
    \from collections.abc import Iterator
    \from pypgl import FrozenHalfplaneIntersection
    def __len__(self) -> int: ...
    def __getitem__(self, index: int) -> Halfplane: ...
    def __iter__(self) -> Iterator[Halfplane]: ...
    def __contains__(self, point: Point) -> bool: ...
    def frozen(self) -> FrozenHalfplaneIntersection: ...

# The six other mutable shapes take the generic point sugar plus frozen(), the
# Python layer's hashable copy (pypgl/__init__.py). Each must precede the generic
# rule below, which would otherwise claim it and leave frozen() out of the stub.
# The Frozen* classes live in the Python layer rather than in the extension, so
# the return type is imported from the package; a type checker resolves the cycle
# the way it resolves any other stub cycle.
Convex\.__suffix__:
    \from collections.abc import Iterator
    \from pypgl import FrozenConvex
    def __len__(self) -> int: ...
    def __getitem__(self, index: int) -> Point: ...
    def __iter__(self) -> Iterator[Point]: ...
    def __contains__(self, point: Point) -> bool: ...
    def frozen(self) -> FrozenConvex: ...

MonotoneChain\.__suffix__:
    \from collections.abc import Iterator
    \from pypgl import FrozenMonotoneChain
    def __len__(self) -> int: ...
    def __getitem__(self, index: int) -> Point: ...
    def __iter__(self) -> Iterator[Point]: ...
    def __contains__(self, point: Point) -> bool: ...
    def frozen(self) -> FrozenMonotoneChain: ...

Polyline\.__suffix__:
    \from collections.abc import Iterator
    \from pypgl import FrozenPolyline
    def __len__(self) -> int: ...
    def __getitem__(self, index: int) -> Point: ...
    def __iter__(self) -> Iterator[Point]: ...
    def __contains__(self, point: Point) -> bool: ...
    def frozen(self) -> FrozenPolyline: ...

Polygon\.__suffix__:
    \from collections.abc import Iterator
    \from pypgl import FrozenPolygon
    def __len__(self) -> int: ...
    def __getitem__(self, index: int) -> Point: ...
    def __iter__(self) -> Iterator[Point]: ...
    def __contains__(self, point: Point) -> bool: ...
    def frozen(self) -> FrozenPolygon: ...

PolygonWithHoles\.__suffix__:
    \from collections.abc import Iterator
    \from pypgl import FrozenPolygonWithHoles
    def __len__(self) -> int: ...
    def __getitem__(self, index: int) -> Point: ...
    def __iter__(self) -> Iterator[Point]: ...
    def __contains__(self, point: Point) -> bool: ...
    def frozen(self) -> FrozenPolygonWithHoles: ...

PolygonSet\.__suffix__:
    \from collections.abc import Iterator
    \from pypgl import FrozenPolygonSet
    def __len__(self) -> int: ...
    def __getitem__(self, index: int) -> Point: ...
    def __iter__(self) -> Iterator[Point]: ...
    def __contains__(self, point: Point) -> bool: ...
    def frozen(self) -> FrozenPolygonSet: ...

# Every other shape is indexed/iterated over its defining points. PolygonWithHoles
# takes this rule too: C++ iterates its holes and gives it no size()/get() at all,
# but the Python layer flattens its rings' vertices so it reads like every other
# shape (see pypgl/__init__.py). The class-name
# segment in the query keeps this from matching the bare module suffix
# (`_pgl.__suffix__`), which would inject the methods at module scope.
\.[A-Z]\w*\.__suffix__:
    \from collections.abc import Iterator
    def __len__(self) -> int: ...
    def __getitem__(self, index: int) -> Point: ...
    def __iter__(self) -> Iterator[Point]: ...
    def __contains__(self, point: Point) -> bool: ...
