from __future__ import annotations

from xfintech.data.common.paginate import Paginate
from xfintech.fabric.column.info import ColumnInfo
from xfintech.fabric.column.kind import ColumnKind
from xfintech.fabric.table.info import TableInfo

PROVIDER = "baostock"
SOURCE_NAME = "query_sz50_stocks"
URL = "http://www.baostock.com/mainContent?file=sz50Stock.md"
ARGS = {}

# Exported constants
NAME = "sz50stock"
KEY = "/baostock/sz50stock"
PAGINATE = Paginate(
    pagesize=10000,
    pagelimit=100,
)
SOURCE = TableInfo(
    desc="上证50成分股（BaoStock格式）",
    meta={
        "provider": PROVIDER,
        "source": SOURCE_NAME,
        "url": URL,
        "args": ARGS,
        "type": "static",
        "scale": "crosssection",
    },
    columns=[
        ColumnInfo(name="updateDate", kind=ColumnKind.STRING, desc="更新日期"),
        ColumnInfo(name="code", kind=ColumnKind.STRING, desc="证券代码"),
        ColumnInfo(name="code_name", kind=ColumnKind.STRING, desc="证券名称"),
    ],
)
TARGET = TableInfo(
    desc="上证50成分股（xfintech格式）",
    meta={
        "key": KEY,
        "name": NAME,
        "type": "static",
        "scale": "crosssection",
    },
    columns=[
        ColumnInfo(name="update_date", kind=ColumnKind.STRING, desc="更新日期"),
        ColumnInfo(name="code", kind=ColumnKind.STRING, desc="证券代码"),
        ColumnInfo(name="name", kind=ColumnKind.STRING, desc="证券名称"),
    ],
)
