from typing import Any, Optional
from .base import Executable as Executable
from .elements import ColumnElement as ColumnElement
from .selectable import FromClause as FromClause
from . import util as sqlutil
from .visitors import VisitableType as VisitableType

def register_function(identifier, fn, package: str = ...): ...

class FunctionElement(Executable, ColumnElement, FromClause):
    packagenames: Any = ...
    clause_expr: Any = ...
    def __init__(self, *clauses, **kwargs) -> None: ...
    @property
    def columns(self): ...
    @property
    def clauses(self): ...
    def over(self, partition_by: Optional[Any] = ..., order_by: Optional[Any] = ...,
             rows: Optional[Any] = ..., range_: Optional[Any] = ...): ...
    def within_group(self, *order_by): ...
    def filter(self, *criterion): ...
    def get_children(self, **kwargs): ...
    def within_group_type(self, within_group): ...
    def alias(self, name: Optional[Any] = ..., flat: bool = ...): ...
    def select(self): ...
    def scalar(self): ...
    def execute(self): ...
    def self_group(self, against: Optional[Any] = ...): ...

class _FunctionGenerator(object):
    opts: Any = ...
    def __init__(self, **opts) -> None: ...
    def __getattr__(self, name): ...
    def __call__(self, *c, **kwargs): ...

func: _FunctionGenerator = ...
modifier: _FunctionGenerator = ...

class Function(FunctionElement):
    __visit_name__: str = ...
    packagenames: Any = ...
    name: Any = ...
    type: Any = ...
    def __init__(self, name, *clauses, **kw) -> None: ...

class _GenericMeta(VisitableType):
    def __init__(cls, clsname, bases, clsdict) -> None: ...

class GenericFunction(Function, metaclass=_GenericMeta):
    coerce_arguments: bool = ...
    packagenames: Any = ...
    clause_expr: Any = ...
    type: Any = ...
    def __init__(self, *args, **kwargs) -> None: ...

class next_value(GenericFunction):
    type: Any = ...
    name: str = ...
    sequence: Any = ...
    def __init__(self, seq, **kw) -> None: ...

class AnsiFunction(GenericFunction):
    def __init__(self, **kwargs) -> None: ...

class ReturnTypeFromArgs(GenericFunction):
    def __init__(self, *args, **kwargs) -> None: ...

class coalesce(ReturnTypeFromArgs): ...
class max(ReturnTypeFromArgs): ...
class min(ReturnTypeFromArgs): ...
class sum(ReturnTypeFromArgs): ...

class now(GenericFunction):
    type: Any = ...

class concat(GenericFunction):
    type: Any = ...

class char_length(GenericFunction):
    type: Any = ...
    def __init__(self, arg, **kwargs) -> None: ...

class random(GenericFunction): ...

class count(GenericFunction):
    type: Any = ...
    def __init__(self, expression: Optional[Any] = ..., **kwargs) -> None: ...

class current_date(AnsiFunction):
    type: Any = ...

class current_time(AnsiFunction):
    type: Any = ...

class current_timestamp(AnsiFunction):
    type: Any = ...

class current_user(AnsiFunction):
    type: Any = ...

class localtime(AnsiFunction):
    type: Any = ...

class localtimestamp(AnsiFunction):
    type: Any = ...

class session_user(AnsiFunction):
    type: Any = ...

class sysdate(AnsiFunction):
    type: Any = ...

class user(AnsiFunction):
    type: Any = ...

class array_agg(GenericFunction):
    type: Any = ...
    def __init__(self, *args, **kwargs) -> None: ...

class OrderedSetAgg(GenericFunction):
    array_for_multi_clause: bool = ...
    def within_group_type(self, within_group): ...

class mode(OrderedSetAgg): ...

class percentile_cont(OrderedSetAgg):
    array_for_multi_clause: bool = ...

class percentile_disc(OrderedSetAgg):
    array_for_multi_clause: bool = ...

class rank(GenericFunction):
    type: Any = ...

class dense_rank(GenericFunction):
    type: Any = ...

class percent_rank(GenericFunction):
    type: Any = ...

class cume_dist(GenericFunction):
    type: Any = ...
