# 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 CbBasic(Base):
    """可转债基础信息"""

    __tablename__: str = "cb_basic"
    __api_id__: ClassVar[int] = 185
    __api_name__: ClassVar[str] = "cb_basic"
    __api_title__: ClassVar[str] = "可转债基础信息"
    __api_info_title__: ClassVar[str] = "可转债基础信息"
    __api_path__: ClassVar[List[str]] = ["数据接口", "债券专题"]
    __api_path_ids__: ClassVar[List[int]] = [1, 17]
    __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"]
    __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": "转债代码"},
        "list_date": {"type": "String", "required": False, "description": "上市日期"},
        "exchange": {"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="转债代码")
    bond_full_name = Column("bond_full_name", String(), nullable=True, comment="转债名称")
    bond_short_name = Column("bond_short_name", String(), nullable=True, comment="转债简称")
    cb_code = Column("cb_code", String(), nullable=True, comment="转股申报代码")
    stk_code = Column("stk_code", String(), nullable=True, comment="正股代码")
    stk_short_name = Column("stk_short_name", String(), nullable=True, comment="正股简称")
    maturity = Column("maturity", Float, nullable=True, comment="发行期限(年)")
    par = Column("par", Float, nullable=True, comment="面值")
    issue_price = Column("issue_price", Float, nullable=True, comment="发行价格")
    issue_size = Column("issue_size", Float, nullable=True, comment="发行总额(元)")
    remain_size = Column("remain_size", Float, nullable=True, comment="债券余额(元)")
    value_date = Column("value_date", Date, nullable=True, comment="起息日期")
    maturity_date = Column("maturity_date", Date, nullable=True, comment="到期日期")
    rate_type = Column("rate_type", String(), nullable=True, comment="利率类型")
    coupon_rate = Column("coupon_rate", Float, nullable=True, comment="票面利率(%)")
    add_rate = Column("add_rate", Float, nullable=True, comment="补偿利率(%)")
    pay_per_year = Column("pay_per_year", Integer, nullable=True, comment="年付息次数")
    list_date = Column("list_date", Date, nullable=True, comment="上市日期")
    delist_date = Column("delist_date", Date, nullable=True, comment="摘牌日")
    exchange = Column("exchange", String(), nullable=True, comment="上市地点")
    conv_start_date = Column("conv_start_date", Date, nullable=True, comment="转股起始日")
    conv_end_date = Column("conv_end_date", Date, nullable=True, comment="转股截止日")
    conv_stop_date = Column("conv_stop_date", Date, nullable=True, comment="停止转股日(提前到期)")
    first_conv_price = Column("first_conv_price", Float, nullable=True, comment="初始转股价")
    conv_price = Column("conv_price", Float, nullable=True, comment="最新转股价")
    rate_clause = Column("rate_clause", String(), nullable=True, comment="利率说明")
    put_clause = Column("put_clause", String(), nullable=True, comment="赎回条款")
    maturity_put_price = Column("maturity_put_price", Float, nullable=True, comment="到期赎回价格(含税)")
    call_clause = Column("call_clause", String(), nullable=True, comment="回售条款")
    reset_clause = Column("reset_clause", String(), nullable=True, comment="特别向下修正条款")
    conv_clause = Column("conv_clause", String(), nullable=True, comment="转股条款")
    guarantor = Column("guarantor", String(), nullable=True, comment="担保人")
    guarantee_type = Column("guarantee_type", String(), nullable=True, comment="担保方式")
    issue_rating = Column("issue_rating", String(), nullable=True, comment="发行信用等级")
    newest_rating = Column("newest_rating", String(), nullable=True, comment="最新信用等级")
    rating_comp = Column("rating_comp", String(), nullable=True, comment="最新评级机构")

apply_table_dialect_options(CbBasic)
