# 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 ReportRc(Base):
    """券商盈利预测数据"""

    __tablename__: str = "report_rc"
    __api_id__: ClassVar[int] = 292
    __api_name__: ClassVar[str] = "report_rc"
    __api_title__: ClassVar[str] = "券商盈利预测数据"
    __api_info_title__: ClassVar[str] = "券商盈利预测数据"
    __api_path__: ClassVar[List[str]] = ["数据接口", "股票数据", "特色数据"]
    __api_path_ids__: ClassVar[List[int]] = [1, 2, 7]
    __api_points_required__: ClassVar[int] = 0
    __api_special_permission__: ClassVar[bool] = False
    __has_vip__: ClassVar[bool] = False
    __dependencies__: ClassVar[List[str]] = ["stock_basic"]
    __primary_key__: ClassVar[List[str]] = ["ts_code", "report_date", "org_name", "author_name"]
    __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": "股票代码"},
        "report_date": {"type": "String", "required": False, "description": "报告日期"},
        "start_date": {"type": "String", "required": False, "description": "报告开始日期"},
        "end_date": {"type": "String", "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="股票代码")
    name = Column("name", String(), nullable=True, comment="股票名称")
    report_date = Column("report_date", Date, nullable=False, comment="研报日期")
    report_title = Column("report_title", String(), nullable=True, comment="报告标题")
    report_type = Column("report_type", String(), nullable=True, comment="报告类型")
    classify = Column("classify", String(), nullable=True, comment="报告分类")
    org_name = Column("org_name", String(), nullable=False, comment="机构名称")
    author_name = Column("author_name", String(), nullable=False, comment="作者")
    quarter = Column("quarter", String(), nullable=True, comment="预测报告期")
    op_rt = Column("op_rt", Float, nullable=True, comment="预测营业收入(万元)")
    op_pr = Column("op_pr", Float, nullable=True, comment="预测营业利润(万元)")
    tp = Column("tp", Float, nullable=True, comment="预测利润总额(万元)")
    np = Column("np", Float, nullable=True, comment="预测净利润(万元)")
    eps = Column("eps", Float, nullable=True, comment="预测每股收益(元)")
    pe = Column("pe", Float, nullable=True, comment="预测市盈率(元)")
    rd = Column("rd", Float, nullable=True, comment="预测股息率(元)")
    roe = Column("roe", Float, nullable=True, comment="预测净资产收益率(元)")
    ev_ebitda = Column("ev_ebitda", Float, nullable=True, comment="预测EV/EBITDA")
    rating = Column("rating", String(), nullable=True, comment="卖方评级")
    max_price = Column("max_price", Float, nullable=True, comment="预测最高目标价")
    min_price = Column("min_price", Float, nullable=True, comment="预测最低目标价")
    imp_dg = Column("imp_dg", String(), nullable=True, comment="机构关注度")
    create_time = Column("create_time", DateTime, nullable=True, comment="TS数据更新时间")

apply_table_dialect_options(ReportRc)
