# This file is auto-generated by generate_models.py
# This file may be manually edited after generation
# The file has been formatted using isort and black

from typing import Any, ClassVar, Dict, List

from clickhouse_sqlalchemy import engines
from sqlalchemy import Column, PrimaryKeyConstraint, text

from tushare_models.core import Base, Date, DateTime, Float, Integer, String


class RtHkTick(Base):
    """港交所最新行情tick"""

    __tablename__: str = "rt_hk_tick"
    __api_id__: ClassVar[int] = 352
    __api_name__: ClassVar[str] = "rt_hk_tick"
    __api_title__: ClassVar[str] = "港交所最新行情tick"
    __api_info_title__: ClassVar[str] = "港交所最新行情tick"
    __api_path__: ClassVar[List[str]] = ["港交所最新行情tick"]
    __api_path_ids__: ClassVar[List[int]] = []
    __api_points_required__: ClassVar[int] = 2000
    __api_special_permission__: ClassVar[bool] = False
    __has_vip__: ClassVar[bool] = False
    __dependencies__: ClassVar[List[str]] = []
    __primary_key__: ClassVar[List[str]] = ["code", "trade_time"]
    __start_date__: ClassVar[str | None] = None
    __end_date__: ClassVar[str | None] = None
    __api_params__: ClassVar[Dict[str, Any]] = {
        "topic": {"type": "str", "required": False, "description": ""},
        "ts_code": {"type": "str", "required": True, "description": "逗号隔开多个code"},
        "limit": {"type": "int", "required": False, "description": "单次返回数据长度"},
        "offset": {"type": "int", "required": False, "description": "请求数据的开始位移量"},
    }

    __mapper_args__ = {"primary_key": __primary_key__}
    __table_args__ = (
        PrimaryKeyConstraint(*__primary_key__),
        # ClickHouse引擎
        engines.ReplacingMergeTree(order_by=__primary_key__),
        {
            "comment": "港交所最新行情tick",
            # MySQL引擎
            "mysql_engine": "InnoDB",
            # StarRocks引擎
            "starrocks_primary_key": ",".join(__primary_key__),
            "starrocks_order_by": ",".join(__primary_key__),
            # Apache Doris引擎
            "doris_unique_key": __primary_key__,
            # Databend引擎
            "databend_cluster_by": __primary_key__,
        },
    )

    ts_code = Column("ts_code", String(16), nullable=False, default="", server_default=text("''"), comment="ts-code")
    name = Column("name", String(), nullable=False, default="", server_default=text("''"), comment="名称")
    trade_time = Column(
        "trade_time", String(), nullable=False, default="", server_default=text("''"), comment="交易日期"
    )
    pre_close = Column("pre_close", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    price = Column("price", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    high = Column("high", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    open = Column("open", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    low = Column("low", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    close = Column("close", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    open_interest = Column(
        "open_interest", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment=""
    )
    vol = Column("vol", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    amount = Column("amount", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    num = Column("num", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    a1_p = Column("a1_p", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    a1_v = Column("a1_v", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    b1_p = Column("b1_p", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    b1_v = Column("b1_v", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    a2_v = Column("a2_v", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    a2_p = Column("a2_p", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    b2_v = Column("b2_v", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    b2_p = Column("b2_p", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    a3_v = Column("a3_v", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    a3_p = Column("a3_p", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    b3_v = Column("b3_v", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    b3_p = Column("b3_p", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    a4_v = Column("a4_v", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    a4_p = Column("a4_p", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    b4_v = Column("b4_v", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    b4_p = Column("b4_p", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    a5_v = Column("a5_v", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    a5_p = Column("a5_p", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    b5_v = Column("b5_v", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
    b5_p = Column("b5_p", Float, nullable=False, default=0.0, server_default=text("'0.0'"), comment="")
