"""ClickHouse Alchemy - A SQLAlchemy Core-style library for ClickHouse."""

__version__ = "0.1.0"

# Types
from .datatypes import (
    TypeEngine,
    # Integers
    UInt8,
    UInt16,
    UInt32,
    UInt64,
    UInt128,
    UInt256,
    Int8,
    Int16,
    Int32,
    Int64,
    Int128,
    Int256,
    # Floats
    Float32,
    Float64,
    # Strings
    String,
    FixedString,
    # Date/Time
    Date,
    Date32,
    DateTime,
    DateTime64,
    # Special types
    UUID,
    IPv4,
    IPv6,
    Boolean,
    # Decimal
    Decimal,
    # Enums
    Enum8,
    Enum16,
    # Composites
    Array,
    Nullable,
    LowCardinality,
    Tuple,
    Map,
    Nested,
    SimpleAggregateFunction,
    AggregateFunction,
)

# Table engines
from .engines import (
    TableEngine,
    MergeTree,
    ReplacingMergeTree,
    SummingMergeTree,
    AggregatingMergeTree,
    CollapsingMergeTree,
    VersionedCollapsingMergeTree,
    GraphiteMergeTree,
    Log,
    TinyLog,
    StripeLog,
    Memory,
    Buffer,
    Distributed,
    ReplicatedMergeTree,
    ReplicatedReplacingMergeTree,
    Null,
    URL,
    File,
    Merge,
    Dictionary,
    MaterializedView,
)

# Schema
from .schema import (
    MetaData,
    Table,
    Column,
    Index,
    Constraint,
    Projection,
)

# SQL expressions
from .sql import (
    # Base classes
    ClauseElement,
    ColumnElement,
    ColumnClause,
    TableClause,
    # Expression types
    BinaryExpression,
    UnaryExpression,
    Literal,
    FunctionCall,
    Cast,
    Case,
    Subquery,
    Exists,
    # Factory functions
    literal,
    column,
    table,
    cast,
    case,
    tuple_,
    exists,
    all_,
    any_,
    # Boolean
    and_,
    or_,
    not_,
    # Ordering
    asc,
    desc,
    nulls_first,
    nulls_last,
    # Select
    select,
    cte,
    alias,
    values,
    union,
    union_all,
    intersect,
    except_,
    # DML
    insert,
    alter_table,
    optimize,
    truncate,
    # DDL
    create_table,
    drop_table,
    create_database,
    drop_database,
    create_view,
    create_materialized_view,
    drop_view,
    # Functions module
    func,
)

# Engine
from .engine import (
    Engine,
    Connection,
    Result,
    Transaction,
    create_engine,
    URL as DatabaseURL,  # Renamed to avoid conflict with URL table engine
)

# Dialects
from .dialects import ClickHouseDialect

__all__ = [
    # Version
    "__version__",
    # Types
    "TypeEngine",
    "UInt8",
    "UInt16",
    "UInt32",
    "UInt64",
    "UInt128",
    "UInt256",
    "Int8",
    "Int16",
    "Int32",
    "Int64",
    "Int128",
    "Int256",
    "Float32",
    "Float64",
    "String",
    "FixedString",
    "Date",
    "Date32",
    "DateTime",
    "DateTime64",
    "UUID",
    "IPv4",
    "IPv6",
    "Boolean",
    "Decimal",
    "Enum8",
    "Enum16",
    "Array",
    "Nullable",
    "LowCardinality",
    "Tuple",
    "Map",
    "Nested",
    "SimpleAggregateFunction",
    "AggregateFunction",
    # Table engines
    "TableEngine",
    "MergeTree",
    "ReplacingMergeTree",
    "SummingMergeTree",
    "AggregatingMergeTree",
    "CollapsingMergeTree",
    "VersionedCollapsingMergeTree",
    "GraphiteMergeTree",
    "Log",
    "TinyLog",
    "StripeLog",
    "Memory",
    "Buffer",
    "Distributed",
    "ReplicatedMergeTree",
    "ReplicatedReplacingMergeTree",
    "Null",
    "URL",
    "File",
    "Merge",
    "Dictionary",
    "MaterializedView",
    # Schema
    "MetaData",
    "Table",
    "Column",
    "Index",
    "Constraint",
    "Projection",
    # SQL expressions
    "ClauseElement",
    "ColumnElement",
    "ColumnClause",
    "TableClause",
    "BinaryExpression",
    "UnaryExpression",
    "Literal",
    "FunctionCall",
    "Cast",
    "Case",
    "Subquery",
    "Exists",
    "literal",
    "column",
    "table",
    "cast",
    "case",
    "tuple_",
    "exists",
    "all_",
    "any_",
    "and_",
    "or_",
    "not_",
    "asc",
    "desc",
    "nulls_first",
    "nulls_last",
    "select",
    "cte",
    "alias",
    "values",
    "union",
    "union_all",
    "intersect",
    "except_",
    "insert",
    "alter_table",
    "optimize",
    "truncate",
    "create_table",
    "drop_table",
    "create_database",
    "drop_database",
    "create_view",
    "create_materialized_view",
    "drop_view",
    "func",
    # Engine
    "Engine",
    "Connection",
    "Result",
    "Transaction",
    "create_engine",
    "DatabaseURL",
    # Dialects
    "ClickHouseDialect",
]
