# 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 sqlalchemy import Column, PrimaryKeyConstraint, text

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


class HkFinaIndicator(Base):
    """港股财务指标数据"""

    __tablename__: str = "hk_fina_indicator"
    __api_id__: ClassVar[int] = 388
    __api_name__: ClassVar[str] = "hk_fina_indicator"
    __api_title__: ClassVar[str] = "港股财务指标数据"
    __api_info_title__: ClassVar[str] = "港股财务指标数据"
    __api_path__: ClassVar[List[str]] = ["数据接口", "港股数据"]
    __api_path_ids__: ClassVar[List[int]] = [1, 19]
    __api_points_required__: ClassVar[int] = 0
    __api_special_permission__: ClassVar[bool] = False
    __has_vip__: ClassVar[bool] = False
    __dependencies__: ClassVar[List[str]] = ["hk_basic"]
    __primary_key__: ClassVar[List[str]] = ["ts_code", "end_date"]
    __start_date__: ClassVar[str | None] = None
    __end_date__: ClassVar[str | None] = None
    __api_params__: ClassVar[Dict[str, Any]] = {
        "ts_code": {"type": "String", "required": True, "description": "股票代码"},
        "period": {
            "type": "String",
            "required": False,
            "description": "报告期（格式：YYYYMMDD，每个季度最后一天的日期，如20241231)",
        },
        "report_type": {
            "type": "String",
            "required": False,
            "description": "报告期类型(Q1一季报Q2半年报Q3三季报Q4年报)",
        },
        "start_date": {"type": "String", "required": False, "description": "报告期开始时间（格式：YYYYMMDD）"},
        "end_date": {"type": "String", "required": False, "description": "报告结束始时间（格式：YYYYMMDD）"},
        "limit": {"type": "Int64", "required": False, "description": "单次返回数据长度"},
        "offset": {"type": "Int64", "required": False, "description": "请求数据的开始位移量"},
    }

    __mapper_args__ = {"primary_key": __primary_key__}
    __table_args__ = (
        PrimaryKeyConstraint(*__primary_key__),
        {
            "comment": "港股财务指标数据",
            # MySQL引擎
            "mysql_engine": "InnoDB",
        },
    )

    ts_code = Column("ts_code", String(16), nullable=False, comment="股票代码")
    name = Column("name", String(), nullable=True, comment="股票名称")
    end_date = Column("end_date", Date, nullable=False, comment="报告期")
    report_type = Column("report_type", String(), nullable=True, comment="报告期类型")
    std_report_date = Column("std_report_date", Date, nullable=True, comment="标准报告期")
    per_netcash_operate = Column("per_netcash_operate", Float, nullable=True, comment="每股经营现金流(元)")
    per_oi = Column("per_oi", Float, nullable=True, comment="每股营业收入(元)")
    bps = Column("bps", Float, nullable=True, comment="每股净资产(元)")
    basic_eps = Column("basic_eps", Float, nullable=True, comment="基本每股收益(元)")
    diluted_eps = Column("diluted_eps", Float, nullable=True, comment="稀释每股收益(元)")
    operate_income = Column("operate_income", Float, nullable=True, comment="营业总收入(元)")
    operate_income_yoy = Column("operate_income_yoy", Float, nullable=True, comment="营业总收入同比增长(%)")
    gross_profit = Column("gross_profit", Float, nullable=True, comment="毛利润(元)")
    gross_profit_yoy = Column("gross_profit_yoy", Float, nullable=True, comment="毛利润同比增长(%)")
    holder_profit = Column("holder_profit", Float, nullable=True, comment="归母净利润(元)")
    holder_profit_yoy = Column("holder_profit_yoy", Float, nullable=True, comment="归母净利润同比增长(%)")
    gross_profit_ratio = Column("gross_profit_ratio", Float, nullable=True, comment="毛利率(%)")
    eps_ttm = Column("eps_ttm", Float, nullable=True, comment="ttm每股收益(元)")
    operate_income_qoq = Column("operate_income_qoq", Float, nullable=True, comment="营业总收入滚动环比增长(%)")
    net_profit_ratio = Column("net_profit_ratio", Float, nullable=True, comment="净利率(%)")
    roe_avg = Column("roe_avg", Float, nullable=True, comment="平均净资产收益率(%)")
    gross_profit_qoq = Column("gross_profit_qoq", Float, nullable=True, comment="毛利润滚动环比增长(%)")
    roa = Column("roa", Float, nullable=True, comment="总资产净利率(%)")
    holder_profit_qoq = Column("holder_profit_qoq", Float, nullable=True, comment="归母净利润滚动环比增长(%)")
    roe_yearly = Column("roe_yearly", Float, nullable=True, comment="年化净资产收益率(%)")
    roic_yearly = Column("roic_yearly", Float, nullable=True, comment="年化投资回报率(%)")
    total_assets = Column("total_assets", Float, nullable=True, comment="资产总额")
    total_liabilities = Column("total_liabilities", Float, nullable=True, comment="负债总额")
    tax_ebt = Column("tax_ebt", Float, nullable=True, comment="所得税/利润总额(%)")
    ocf_sales = Column("ocf_sales", Float, nullable=True, comment="经营现金流/营业收入(%)")
    total_parent_equity = Column("total_parent_equity", Float, nullable=True, comment="本公司权益持有人应占权益")
    debt_asset_ratio = Column("debt_asset_ratio", Float, nullable=True, comment="资产负债率(%)")
    operate_profit = Column("operate_profit", Float, nullable=True, comment="经营盈利")
    pretax_profit = Column("pretax_profit", Float, nullable=True, comment="除税前盈利")
    netcash_operate = Column("netcash_operate", Float, nullable=True, comment="经营活动所得现金流量净额")
    netcash_invest = Column("netcash_invest", Float, nullable=True, comment="投资活动耗用现金流量净额")
    netcash_finance = Column("netcash_finance", Float, nullable=True, comment="融资活动耗用现金流量净额")
    end_cash = Column("end_cash", Float, nullable=True, comment="期末的现金及现金等价物")
    divi_ratio = Column("divi_ratio", Float, nullable=True, comment="分红比例")
    dividend_rate = Column("dividend_rate", Float, nullable=True, comment="股息率")
    current_ratio = Column("current_ratio", Float, nullable=True, comment="流动比率(倍)")
    common_acs = Column("common_acs", Float, nullable=True, comment="普通股应计股息")
    currentdebt_debt = Column("currentdebt_debt", Float, nullable=True, comment="流动负债/总负债(%)")
    issued_common_shares = Column("issued_common_shares", Float, nullable=True, comment="已发行普通股")
    hk_common_shares = Column("hk_common_shares", Float, nullable=True, comment="港股本")
    per_shares = Column("per_shares", Float, nullable=True, comment="每手股数")
    total_market_cap = Column("total_market_cap", Float, nullable=True, comment="总市值")
    hksk_market_cap = Column("hksk_market_cap", Float, nullable=True, comment="港股市值")
    pe_ttm = Column("pe_ttm", Float, nullable=True, comment="滚动市盈率")
    pb_ttm = Column("pb_ttm", Float, nullable=True, comment="滚动市净率")
    report_date_sq = Column("report_date_sq", Date, nullable=True, comment="季报日期")
    report_type_sq = Column("report_type_sq", String(), nullable=True, comment="报告类型")
    operate_income_sq = Column("operate_income_sq", Float, nullable=True, comment="营业收入")
    dps_hkd = Column("dps_hkd", Float, nullable=True, comment="每股股息(港元)")
    operate_income_qoq_sq = Column("operate_income_qoq_sq", Float, nullable=True, comment="营业收入环比")
    net_profit_ratio_sq = Column("net_profit_ratio_sq", Float, nullable=True, comment="净利润率")
    holder_profit_sq = Column("holder_profit_sq", Float, nullable=True, comment="归属于股东净利润")
    holder_profit_qoq_sq = Column("holder_profit_qoq_sq", Float, nullable=True, comment="归母净利润环比")
    roe_avg_sq = Column("roe_avg_sq", Float, nullable=True, comment="平均净资产收益率")
    pe_ttm_sq = Column("pe_ttm_sq", Float, nullable=True, comment="季报滚动市盈率")
    pb_ttm_sq = Column("pb_ttm_sq", Float, nullable=True, comment="季报滚动市净率")
    roa_sq = Column("roa_sq", Float, nullable=True, comment="总资产收益率")
    start_date = Column("start_date", Date, nullable=True, comment="会计年度起始日")
    fiscal_year = Column("fiscal_year", Float, nullable=True, comment="会计年度截止日")
    currency = Column("currency", String(), nullable=True, comment="币种 港元(hkd)")
    is_cny_code = Column("is_cny_code", Float, nullable=True, comment="是否人民币代码")
    dps_hkd_ly = Column("dps_hkd_ly", Float, nullable=True, comment="上一年每股股息")
    org_type = Column("org_type", String(), nullable=True, comment="企业类型")
    premium_income = Column("premium_income", Float, nullable=True, comment="保费收入")
    premium_income_yoy = Column("premium_income_yoy", Float, nullable=True, comment="保费收入同比")
    net_interest_income = Column("net_interest_income", Float, nullable=True, comment="净利息收入")
    net_interest_income_yoy = Column("net_interest_income_yoy", Float, nullable=True, comment="净利息收入同比")
    fee_commission_income = Column("fee_commission_income", Float, nullable=True, comment="手续费及佣金收入")
    fee_commission_income_yoy = Column(
        "fee_commission_income_yoy", Float, nullable=True, comment="手续费及佣金收入同比"
    )
    accounts_rece_tdays = Column("accounts_rece_tdays", Float, nullable=True, comment="应收账款周转率(次)")
    inventory_tdays = Column("inventory_tdays", Float, nullable=True, comment="存货周转率(次)")
    current_assets_tdays = Column("current_assets_tdays", Float, nullable=True, comment="流动资产周转率(次)")
    total_assets_tdays = Column("total_assets_tdays", Float, nullable=True, comment="总资产周转率(次)")
    premium_expense = Column("premium_expense", Float, nullable=True, comment="保险赔付支出")
    loan_deposit = Column("loan_deposit", Float, nullable=True, comment="贷款/存款")
    loan_equity = Column("loan_equity", Float, nullable=True, comment="贷款/股东权益")
    loan_assets = Column("loan_assets", Float, nullable=True, comment="贷款/总资产")
    deposit_equity = Column("deposit_equity", Float, nullable=True, comment="存款/股东权益")
    deposit_assets = Column("deposit_assets", Float, nullable=True, comment="存款/总资产")
    equity_multiplier = Column("equity_multiplier", Float, nullable=True, comment="权益乘数")
    equity_ratio = Column("equity_ratio", Float, nullable=True, comment="产权比率")

apply_table_dialect_options(HkFinaIndicator)
