"""this file is generated by tools/generate_sql_functions.py"""

from typing import assert_type
from typing import Tuple

from sqlalchemy import column
from sqlalchemy import func
from sqlalchemy import Integer
from sqlalchemy import Select
from sqlalchemy import select
from sqlalchemy import Sequence
from sqlalchemy import String
from sqlalchemy.sql import functions

# START GENERATED FUNCTION TYPING TESTS

# code within this block is **programmatically,
# statically generated** by tools/generate_sql_functions.py


# test the aggregate_strings() function.
# this function is somewhat special case.

stmt1 = select(func.aggregate_strings(column("x", String), ","))
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*str\]\]
reveal_type(stmt1)


# test the array_agg() function.
# this function is a ReturnTypeFromArgs type.

fn2 = func.array_agg(column("x", Integer))
assert_type(fn2, functions.array_agg[int])

stmt2 = select(func.array_agg(column("x", Integer)))
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*Sequence\[.*int\]\]\]
reveal_type(stmt2)


# test the char_length() function.
# this function is fixed to the SQL INTEGER class, or the Tuple\[.*int\] type.

fn3 = func.char_length(column("x"))
assert_type(fn3, functions.char_length)

stmt3 = select(func.char_length(column("x")))
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*int\]\]
reveal_type(stmt3)


# test the coalesce() function.
# this function is a ReturnTypeFromArgs type.

fn4 = func.coalesce(column("x", Integer))
assert_type(fn4, functions.coalesce[int])

stmt4 = select(func.coalesce(column("x", Integer)))
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*int\]\]
reveal_type(stmt4)


# test the concat() function.
# this function is fixed to the SQL VARCHAR class, or the Tuple\[.*str\] type.

fn5 = func.concat()
assert_type(fn5, functions.concat)

stmt5 = select(func.concat())
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*str\]\]
reveal_type(stmt5)


# test the count() function.
# this function is fixed to the SQL INTEGER class, or the Tuple\[.*int\] type.

fn6 = func.count(column("x"))
assert_type(fn6, functions.count)

stmt6 = select(func.count(column("x")))
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*int\]\]
reveal_type(stmt6)


# test the cume_dist() function.
# this function is fixed to the SQL NUMERIC class, or the Tuple\[.*Decimal\] type.

fn7 = func.cume_dist()
assert_type(fn7, functions.cume_dist)

stmt7 = select(func.cume_dist())
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*Decimal\]\]
reveal_type(stmt7)


# test the current_date() function.
# this function is fixed to the SQL DATE class, or the Tuple\[.*date\] type.

fn8 = func.current_date()
assert_type(fn8, functions.current_date)

stmt8 = select(func.current_date())
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*date\]\]
reveal_type(stmt8)


# test the current_time() function.
# this function is fixed to the SQL TIME class, or the Tuple\[.*time\] type.

fn9 = func.current_time()
assert_type(fn9, functions.current_time)

stmt9 = select(func.current_time())
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*time\]\]
reveal_type(stmt9)


# test the current_timestamp() function.
# this function is fixed to the SQL DATETIME class, or the Tuple\[.*datetime\] type.

fn10 = func.current_timestamp()
assert_type(fn10, functions.current_timestamp)

stmt10 = select(func.current_timestamp())
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*datetime\]\]
reveal_type(stmt10)


# test the current_user() function.
# this function is fixed to the SQL VARCHAR class, or the Tuple\[.*str\] type.

fn11 = func.current_user()
assert_type(fn11, functions.current_user)

stmt11 = select(func.current_user())
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*str\]\]
reveal_type(stmt11)


# test the dense_rank() function.
# this function is fixed to the SQL INTEGER class, or the Tuple\[.*int\] type.

fn12 = func.dense_rank()
assert_type(fn12, functions.dense_rank)

stmt12 = select(func.dense_rank())
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*int\]\]
reveal_type(stmt12)


# test the localtime() function.
# this function is fixed to the SQL DATETIME class, or the Tuple\[.*datetime\] type.

fn13 = func.localtime()
assert_type(fn13, functions.localtime)

stmt13 = select(func.localtime())
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*datetime\]\]
reveal_type(stmt13)


# test the localtimestamp() function.
# this function is fixed to the SQL DATETIME class, or the Tuple\[.*datetime\] type.

fn14 = func.localtimestamp()
assert_type(fn14, functions.localtimestamp)

stmt14 = select(func.localtimestamp())
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*datetime\]\]
reveal_type(stmt14)


# test the max() function.
# this function is a ReturnTypeFromArgs type.

fn15 = func.max(column("x", Integer))
assert_type(fn15, functions.max[int])

stmt15 = select(func.max(column("x", Integer)))
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*int\]\]
reveal_type(stmt15)


# test the min() function.
# this function is a ReturnTypeFromArgs type.

fn16 = func.min(column("x", Integer))
assert_type(fn16, functions.min[int])

stmt16 = select(func.min(column("x", Integer)))
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*int\]\]
reveal_type(stmt16)


# test the next_value() function.
# this function is fixed to the SQL INTEGER class, or the Tuple\[.*int\] type.

fn17 = func.next_value(Sequence("x_seq"))
assert_type(fn17, functions.next_value)

stmt17 = select(func.next_value(Sequence("x_seq")))
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*int\]\]
reveal_type(stmt17)


# test the now() function.
# this function is fixed to the SQL DATETIME class, or the Tuple\[.*datetime\] type.

fn18 = func.now()
assert_type(fn18, functions.now)

stmt18 = select(func.now())
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*datetime\]\]
reveal_type(stmt18)


# test the percent_rank() function.
# this function is fixed to the SQL NUMERIC class, or the Tuple\[.*Decimal\] type.

fn19 = func.percent_rank()
assert_type(fn19, functions.percent_rank)

stmt19 = select(func.percent_rank())
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*Decimal\]\]
reveal_type(stmt19)


# test the rank() function.
# this function is fixed to the SQL INTEGER class, or the Tuple\[.*int\] type.

fn20 = func.rank()
assert_type(fn20, functions.rank)

stmt20 = select(func.rank())
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*int\]\]
reveal_type(stmt20)


# test the session_user() function.
# this function is fixed to the SQL VARCHAR class, or the Tuple\[.*str\] type.

fn21 = func.session_user()
assert_type(fn21, functions.session_user)

stmt21 = select(func.session_user())
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*str\]\]
reveal_type(stmt21)


# test the sum() function.
# this function is a ReturnTypeFromArgs type.

fn22 = func.sum(column("x", Integer))
assert_type(fn22, functions.sum[int])

stmt22 = select(func.sum(column("x", Integer)))
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*int\]\]
reveal_type(stmt22)


# test the sysdate() function.
# this function is fixed to the SQL DATETIME class, or the Tuple\[.*datetime\] type.

fn23 = func.sysdate()
assert_type(fn23, functions.sysdate)

stmt23 = select(func.sysdate())
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*datetime\]\]
reveal_type(stmt23)


# test the user() function.
# this function is fixed to the SQL VARCHAR class, or the Tuple\[.*str\] type.

fn24 = func.user()
assert_type(fn24, functions.user)

stmt24 = select(func.user())
# EXPECTED_RE_TYPE: .*Select\[Tuple\[.*str\]\]
reveal_type(stmt24)

# END GENERATED FUNCTION TYPING TESTS

stmt_count: Select[Tuple[int, int, int]] = select(
    func.count(), func.count("*"), func.count(1)
)
