# 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 Income(Base):
    """利润表"""

    __tablename__: str = "income"
    __api_id__: ClassVar[int] = 33
    __api_name__: ClassVar[str] = "income"
    __api_title__: ClassVar[str] = "利润表"
    __api_info_title__: ClassVar[str] = "利润表"
    __api_path__: ClassVar[List[str]] = ["数据接口", "股票数据", "财务数据"]
    __api_path_ids__: ClassVar[List[int]] = [1, 2, 5]
    __api_points_required__: ClassVar[int] = 0
    __api_special_permission__: ClassVar[bool] = False
    __has_vip__: ClassVar[bool] = False
    __dependencies__: ClassVar[List[str]] = []
    __primary_key__: ClassVar[List[str]] = ["ts_code", "end_date", "report_type"]
    __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": "股票代码"},
        "ann_date": {"type": "String", "required": False, "description": "公告日期（格式：YYYYMMDD，下同）"},
        "f_ann_date": {"type": "String", "required": False, "description": "实际公告日期"},
        "start_date": {"type": "String", "required": False, "description": "报告期开始日期"},
        "end_date": {"type": "String", "required": False, "description": "报告期结束日期"},
        "period": {"type": "String", "required": False, "description": "报告期"},
        "report_type": {"type": "String", "required": False, "description": "报告类型"},
        "comp_type": {"type": "String", "required": False, "description": "公司类型"},
        "is_calc": {"type": "Int64", "required": False, "description": "是否计算报表"},
        "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="TS代码")
    ann_date = Column("ann_date", Date, nullable=True, comment="公告日期")
    f_ann_date = Column("f_ann_date", Date, nullable=True, comment="实际公告日期")
    end_date = Column("end_date", Date, nullable=False, comment="报告期")
    report_type = Column(
        "report_type",
        String(),
        nullable=False,
        comment="报告类型 1合并报表 2单季合并 3调整单季合并表 4调整合并报表 5调整前合并报表 6母公司报表 7母公司单季表 8 母公司调整单季表 9母公司调整表 10母公司调整前报表 11调整前合并报表 12母公司调整前报表",
    )
    comp_type = Column("comp_type", String(), nullable=True, comment="公司类型(1一般工商业2银行3保险4证券)")
    end_type = Column("end_type", String(), nullable=True, comment="报告期类型")
    basic_eps = Column("basic_eps", Float, nullable=True, comment="基本每股收益")
    diluted_eps = Column("diluted_eps", Float, nullable=True, comment="稀释每股收益")
    total_revenue = Column("total_revenue", Float, nullable=True, comment="营业总收入")
    revenue = Column("revenue", Float, nullable=True, comment="营业收入")
    int_income = Column("int_income", Float, nullable=True, comment="利息收入")
    prem_earned = Column("prem_earned", Float, nullable=True, comment="已赚保费")
    comm_income = Column("comm_income", Float, nullable=True, comment="手续费及佣金收入")
    n_commis_income = Column("n_commis_income", Float, nullable=True, comment="手续费及佣金净收入")
    n_oth_income = Column("n_oth_income", Float, nullable=True, comment="其他经营净收益")
    n_oth_b_income = Column("n_oth_b_income", Float, nullable=True, comment="加:其他业务净收益")
    prem_income = Column("prem_income", Float, nullable=True, comment="保险业务收入")
    out_prem = Column("out_prem", Float, nullable=True, comment="减:分出保费")
    une_prem_reser = Column("une_prem_reser", Float, nullable=True, comment="提取未到期责任准备金")
    reins_income = Column("reins_income", Float, nullable=True, comment="其中:分保费收入")
    n_sec_tb_income = Column("n_sec_tb_income", Float, nullable=True, comment="代理买卖证券业务净收入")
    n_sec_uw_income = Column("n_sec_uw_income", Float, nullable=True, comment="证券承销业务净收入")
    n_asset_mg_income = Column("n_asset_mg_income", Float, nullable=True, comment="受托客户资产管理业务净收入")
    oth_b_income = Column("oth_b_income", Float, nullable=True, comment="其他业务收入")
    fv_value_chg_gain = Column("fv_value_chg_gain", Float, nullable=True, comment="加:公允价值变动净收益")
    invest_income = Column("invest_income", Float, nullable=True, comment="加:投资净收益")
    ass_invest_income = Column("ass_invest_income", Float, nullable=True, comment="其中:对联营企业和合营企业的投资收益")
    forex_gain = Column("forex_gain", Float, nullable=True, comment="加:汇兑净收益")
    total_cogs = Column("total_cogs", Float, nullable=True, comment="营业总成本")
    oper_cost = Column("oper_cost", Float, nullable=True, comment="减:营业成本")
    int_exp = Column("int_exp", Float, nullable=True, comment="减:利息支出")
    comm_exp = Column("comm_exp", Float, nullable=True, comment="减:手续费及佣金支出")
    biz_tax_surchg = Column("biz_tax_surchg", Float, nullable=True, comment="减:营业税金及附加")
    sell_exp = Column("sell_exp", Float, nullable=True, comment="减:销售费用")
    admin_exp = Column("admin_exp", Float, nullable=True, comment="减:管理费用")
    fin_exp = Column("fin_exp", Float, nullable=True, comment="减:财务费用")
    assets_impair_loss = Column("assets_impair_loss", Float, nullable=True, comment="减:资产减值损失")
    prem_refund = Column("prem_refund", Float, nullable=True, comment="退保金")
    compens_payout = Column("compens_payout", Float, nullable=True, comment="赔付总支出")
    reser_insur_liab = Column("reser_insur_liab", Float, nullable=True, comment="提取保险责任准备金")
    div_payt = Column("div_payt", Float, nullable=True, comment="保户红利支出")
    reins_exp = Column("reins_exp", Float, nullable=True, comment="分保费用")
    oper_exp = Column("oper_exp", Float, nullable=True, comment="营业支出")
    compens_payout_refu = Column("compens_payout_refu", Float, nullable=True, comment="减:摊回赔付支出")
    insur_reser_refu = Column("insur_reser_refu", Float, nullable=True, comment="减:摊回保险责任准备金")
    reins_cost_refund = Column("reins_cost_refund", Float, nullable=True, comment="减:摊回分保费用")
    other_bus_cost = Column("other_bus_cost", Float, nullable=True, comment="其他业务成本")
    operate_profit = Column("operate_profit", Float, nullable=True, comment="营业利润")
    non_oper_income = Column("non_oper_income", Float, nullable=True, comment="加:营业外收入")
    non_oper_exp = Column("non_oper_exp", Float, nullable=True, comment="减:营业外支出")
    nca_disploss = Column("nca_disploss", Float, nullable=True, comment="其中:减:非流动资产处置净损失")
    total_profit = Column("total_profit", Float, nullable=True, comment="利润总额")
    income_tax = Column("income_tax", Float, nullable=True, comment="所得税费用")
    n_income = Column("n_income", Float, nullable=True, comment="净利润(含少数股东损益)")
    n_income_attr_p = Column("n_income_attr_p", Float, nullable=True, comment="净利润(不含少数股东损益)")
    minority_gain = Column("minority_gain", Float, nullable=True, comment="少数股东损益")
    oth_compr_income = Column("oth_compr_income", Float, nullable=True, comment="其他综合收益")
    t_compr_income = Column("t_compr_income", Float, nullable=True, comment="综合收益总额")
    compr_inc_attr_p = Column("compr_inc_attr_p", Float, nullable=True, comment="归属于母公司(或股东)的综合收益总额")
    compr_inc_attr_m_s = Column("compr_inc_attr_m_s", Float, nullable=True, comment="归属于少数股东的综合收益总额")
    ebit = Column("ebit", Float, nullable=True, comment="息税前利润")
    ebitda = Column("ebitda", Float, nullable=True, comment="息税折旧摊销前利润")
    insurance_exp = Column("insurance_exp", Float, nullable=True, comment="保险业务支出")
    undist_profit = Column("undist_profit", Float, nullable=True, comment="年初未分配利润")
    distable_profit = Column("distable_profit", Float, nullable=True, comment="可分配利润")
    rd_exp = Column("rd_exp", Float, nullable=True, comment="研发费用")
    fin_exp_int_exp = Column("fin_exp_int_exp", Float, nullable=True, comment="财务费用:利息费用")
    fin_exp_int_inc = Column("fin_exp_int_inc", Float, nullable=True, comment="财务费用:利息收入")
    transfer_surplus_rese = Column("transfer_surplus_rese", Float, nullable=True, comment="盈余公积转入")
    transfer_housing_imprest = Column("transfer_housing_imprest", Float, nullable=True, comment="住房周转金转入")
    transfer_oth = Column("transfer_oth", Float, nullable=True, comment="其他转入")
    adj_lossgain = Column("adj_lossgain", Float, nullable=True, comment="调整以前年度损益")
    withdra_legal_surplus = Column("withdra_legal_surplus", Float, nullable=True, comment="提取法定盈余公积")
    withdra_legal_pubfund = Column("withdra_legal_pubfund", Float, nullable=True, comment="提取法定公益金")
    withdra_biz_devfund = Column("withdra_biz_devfund", Float, nullable=True, comment="提取企业发展基金")
    withdra_rese_fund = Column("withdra_rese_fund", Float, nullable=True, comment="提取储备基金")
    withdra_oth_ersu = Column("withdra_oth_ersu", Float, nullable=True, comment="提取任意盈余公积金")
    workers_welfare = Column("workers_welfare", Float, nullable=True, comment="职工奖金福利")
    distr_profit_shrhder = Column("distr_profit_shrhder", Float, nullable=True, comment="可供股东分配的利润")
    prfshare_payable_dvd = Column("prfshare_payable_dvd", Float, nullable=True, comment="应付优先股股利")
    comshare_payable_dvd = Column("comshare_payable_dvd", Float, nullable=True, comment="应付普通股股利")
    capit_comstock_div = Column("capit_comstock_div", Float, nullable=True, comment="转作股本的普通股股利")
    net_after_nr_lp_correct = Column(
        "net_after_nr_lp_correct", Float, nullable=True, comment="扣除非经常性损益后的净利润(更正前)"
    )
    oth_income = Column("oth_income", Float, nullable=True, comment="其他收益")
    asset_disp_income = Column("asset_disp_income", Float, nullable=True, comment="资产处置收益")
    continued_net_profit = Column("continued_net_profit", Float, nullable=True, comment="持续经营净利润")
    end_net_profit = Column("end_net_profit", Float, nullable=True, comment="终止经营净利润")
    credit_impa_loss = Column("credit_impa_loss", Float, nullable=True, comment="信用减值损失")
    net_expo_hedging_benefits = Column("net_expo_hedging_benefits", Float, nullable=True, comment="净敞口套期收益")
    oth_impair_loss_assets = Column("oth_impair_loss_assets", Float, nullable=True, comment="其他资产减值损失")
    total_opcost = Column("total_opcost", Float, nullable=True, comment="营业总成本2")
    amodcost_fin_assets = Column(
        "amodcost_fin_assets", Float, nullable=True, comment="以摊余成本计量的金融资产终止确认收益"
    )
    update_flag = Column("update_flag", Date, nullable=True, comment="更新标识")

apply_table_dialect_options(Income)
