# 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 UsFinaIndicator(Base):
    """美股财务指标数据"""

    __tablename__: str = "us_fina_indicator"
    __api_id__: ClassVar[int] = 393
    __api_name__: ClassVar[str] = "us_fina_indicator"
    __api_title__: ClassVar[str] = "美股财务指标数据"
    __api_info_title__: ClassVar[str] = "美股财务指标数据"
    __api_path__: ClassVar[List[str]] = ["数据接口", "美股数据"]
    __api_path_ids__: ClassVar[List[int]] = [1, 20]
    __api_points_required__: ClassVar[int] = 0
    __api_special_permission__: ClassVar[bool] = False
    __has_vip__: ClassVar[bool] = False
    __dependencies__: ClassVar[List[str]] = ["us_basic"]
    __primary_key__: ClassVar[List[str]] = ["ts_code", "end_date", "notice_date"]
    __start_date__: ClassVar[str | None] = None
    __end_date__: ClassVar[str | None] = None
    __api_params__: ClassVar[Dict[str, Any]] = {
        "ts_code": {"type": "String", "required": False, "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="股票代码")
    end_date = Column("end_date", Date, nullable=False, comment="报告期")
    ind_type = Column("ind_type", String(), nullable=True, comment="报告类型,Q1一季报,Q2中报,Q3三季报,Q4年报")
    security_name_abbr = Column("security_name_abbr", String(), nullable=True, comment="股票名称")
    accounting_standards = Column("accounting_standards", String(), nullable=True, comment="会计准则")
    notice_date = Column("notice_date", Date, nullable=False, comment="公告日期")
    start_date = Column("start_date", Date, nullable=True, comment="报告期开始时间")
    std_report_date = Column("std_report_date", Date, nullable=True, comment="标准报告期")
    financial_date = Column("financial_date", Date, nullable=True, comment="年结日")
    currency = Column("currency", String(), nullable=True, comment="币种")
    date_type = Column("date_type", Date, nullable=True, comment="报告期类型")
    report_type = Column("report_type", String(), 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="毛利增长")
    parent_holder_netprofit = Column("parent_holder_netprofit", Float, nullable=True, comment="归母净利润")
    parent_holder_netprofit_yoy = Column("parent_holder_netprofit_yoy", Float, nullable=True, comment="归母净利润增长")
    basic_eps = Column("basic_eps", Float, nullable=True, comment="基本每股收益")
    diluted_eps = Column("diluted_eps", Float, nullable=True, comment="稀释每股收益")
    gross_profit_ratio = Column("gross_profit_ratio", Float, nullable=True, comment="销售毛利率")
    net_profit_ratio = Column("net_profit_ratio", Float, nullable=True, comment="销售净利率")
    accounts_rece_tr = Column("accounts_rece_tr", Float, nullable=True, comment="应收账款周转率(次)")
    inventory_tr = Column("inventory_tr", Float, nullable=True, comment="存货周转率(次)")
    total_assets_tr = Column("total_assets_tr", Float, nullable=True, comment="总资产周转率(次)")
    accounts_rece_tdays = Column("accounts_rece_tdays", Float, nullable=True, comment="应收账款周转天数")
    inventory_tdays = Column("inventory_tdays", Float, nullable=True, comment="存货周转天数")
    total_assets_tdays = Column("total_assets_tdays", Float, nullable=True, comment="总资产周转天数")
    roe_avg = Column("roe_avg", Float, nullable=True, comment="净资产收益率")
    roa = Column("roa", Float, nullable=True, comment="总资产净利率")
    current_ratio = Column("current_ratio", Float, nullable=True, comment="流动比率(倍)")
    speed_ratio = Column("speed_ratio", Float, nullable=True, comment="速动比率(倍)")
    ocf_liqdebt = Column("ocf_liqdebt", Float, nullable=True, comment="经营业务现金净额/流动负债")
    debt_asset_ratio = Column("debt_asset_ratio", Float, nullable=True, comment="资产负债率")
    equity_ratio = Column("equity_ratio", Float, nullable=True, comment="产权比率")
    basic_eps_yoy = Column("basic_eps_yoy", Float, nullable=True, comment="基本每股收益同比增长")
    gross_profit_ratio_yoy = Column("gross_profit_ratio_yoy", Float, nullable=True, comment="毛利率同比增长(%)")
    net_profit_ratio_yoy = Column("net_profit_ratio_yoy", Float, nullable=True, comment="净利率同比增长(%)")
    roe_avg_yoy = Column("roe_avg_yoy", Float, nullable=True, comment="平均净资产收益率同比增长(%)")
    roa_yoy = Column("roa_yoy", Float, nullable=True, comment="净资产收益率同比增长(%)")
    debt_asset_ratio_yoy = Column("debt_asset_ratio_yoy", Float, nullable=True, comment="资产负债率同比增长(%)")
    current_ratio_yoy = Column("current_ratio_yoy", Float, nullable=True, comment="流动比率同比增长(%)")
    speed_ratio_yoy = Column("speed_ratio_yoy", Float, nullable=True, comment="速动比率同比增长(%)")
    currency_abbr = Column("currency_abbr", String(), nullable=True, comment="币种")
    total_income = Column("total_income", Float, nullable=True, comment="收入总额")
    total_income_yoy = Column("total_income_yoy", Float, nullable=True, comment="收入总额同比增长")
    premium_income = Column("premium_income", Float, nullable=True, comment="保费收入")
    premium_income_yoy = Column("premium_income_yoy", Float, nullable=True, comment="保费收入同比")
    basic_eps_cs = Column("basic_eps_cs", Float, nullable=True, comment="基本每股收益")
    basic_eps_cs_yoy = Column("basic_eps_cs_yoy", Float, nullable=True, comment="基本每股收益同比增长")
    diluted_eps_cs = Column("diluted_eps_cs", Float, nullable=True, comment="稀释每股收益")
    payout_ratio = Column("payout_ratio", Float, nullable=True, comment="保费收入/赔付支出")
    capitial_ratio = Column("capitial_ratio", Float, nullable=True, comment="总资产周转率")
    roe = Column("roe", Float, nullable=True, comment="净资产收益率")
    roe_yoy = Column("roe_yoy", Float, nullable=True, comment="净资产收益率同比增长")
    debt_ratio = Column("debt_ratio", Float, nullable=True, comment="资产负债率")
    debt_ratio_yoy = Column("debt_ratio_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="净利息收入增长")
    diluted_eps_cs_yoy = Column("diluted_eps_cs_yoy", Float, nullable=True, comment="稀释每股收益增长")
    loan_loss_provision = Column("loan_loss_provision", Float, nullable=True, comment="贷款损失准备")
    loan_loss_provision_yoy = Column("loan_loss_provision_yoy", 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="存款/总资产")
    rol = Column("rol", Float, nullable=True, comment="贷款回报率")
    rod = Column("rod", Float, nullable=True, comment="存款回报率")

apply_table_dialect_options(UsFinaIndicator)
