from typing import Any

from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations
from django.contrib.gis.db.backends.utils import SpatialOperator
from django.db.backends.postgresql.operations import DatabaseOperations
from django.db.models import Func
from django.db.models.fields import Field

BILATERAL: str

class PostGISOperator(SpatialOperator):
    geography: Any = ...
    raster: Any = ...
    def __init__(
        self, geography: bool = ..., raster: bool = ..., **kwargs: Any
    ) -> None: ...
    def as_sql(
        self, connection: Any, lookup: Any, template_params: Any, *args: Any
    ) -> Any: ...
    def check_raster(self, lookup: Any, template_params: Any) -> Any: ...

class ST_Polygon(Func):
    function: str = ...
    def __init__(self, expr: Any) -> None: ...
    @property
    def output_field(self) -> Field[Any, Any]: ...

class PostGISOperations(BaseSpatialOperations, DatabaseOperations):
    name: str = ...
    postgis: bool = ...
    geography: bool = ...
    geom_func_prefix: str = ...
    Adapter: Any = ...
    collect: Any = ...
    extent: Any = ...
    extent3d: Any = ...
    length3d: Any = ...
    makeline: Any = ...
    perimeter3d: Any = ...
    unionagg: Any = ...
    gis_operators: Any = ...
    unsupported_functions: Any = ...
    select: str = ...
    select_extent: Any = ...
    def function_names(self) -> Any: ...
    def spatial_version(self) -> Any: ...
    def geo_db_type(self, f: Any) -> Any: ...
    def get_distance(self, f: Any, dist_val: Any, lookup_type: Any) -> Any: ...
    def get_geom_placeholder(self, f: Any, value: Any, compiler: Any) -> Any: ...
    def postgis_geos_version(self) -> Any: ...
    def postgis_lib_version(self) -> Any: ...
    def postgis_proj_version(self) -> Any: ...
    def postgis_version(self) -> Any: ...
    def postgis_full_version(self) -> Any: ...
    def postgis_version_tuple(self) -> Any: ...
    def proj_version_tuple(self) -> Any: ...
    def spatial_aggregate_name(self, agg_name: Any) -> Any: ...
    def geometry_columns(self) -> Any: ...
    def spatial_ref_sys(self) -> Any: ...
    def parse_raster(self, value: Any) -> Any: ...
    def distance_expr_for_lookup(self, lhs: Any, rhs: Any, **kwargs: Any) -> Any: ...
    def get_geometry_converter(self, expression: Any) -> Any: ...
    def get_area_att_for_field(self, field: Any) -> Any: ...
