# -*- coding: utf-8 -*-

from sqlalchemy import String, Integer, SmallInteger
from sqlalchemy.orm import Mapped, mapped_column

from app.core.base_model import ModelMixin, UserMixin


class BizVarDictModel(ModelMixin, UserMixin):
    """
    变量信息表
    """
    __tablename__: str = 'biz_var_dict'
    __table_args__: dict[str, str] = {'comment': '变量信息'}
    __loader_options__: list[str] = ["created_by", "updated_by"]

    crane_no: Mapped[str | None] = mapped_column(String(255), nullable=True, comment='')
    var_code: Mapped[str | None] = mapped_column(String(50), nullable=True, comment='变量code')
    var_name: Mapped[str | None] = mapped_column(String(50), nullable=True, comment='变量名称')
    mec_type: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='所属机构')
    data_type: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='数据类型')
    switch_type: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='变量类型')
    addr: Mapped[str | None] = mapped_column(String(50), nullable=True, comment='modbus地址')
    gateway_id: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='网关')
    var_sort: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='排序')
    var_group: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='变量分组')
    var_category: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='变量分类')
    translate: Mapped[str | None] = mapped_column(String(50), nullable=True, comment='绑定公式')
    device_no: Mapped[str | None] = mapped_column(String(50), nullable=True, comment='关联设备编号 ')
    is_reverse: Mapped[int | None] = mapped_column(SmallInteger, nullable=True, comment='是否取反')
    is_top_show: Mapped[int | None] = mapped_column(SmallInteger, nullable=True, comment='是否重点显示')
    is_save: Mapped[int | None] = mapped_column(SmallInteger, nullable=True, comment='是否生成')
    is_calibration: Mapped[int | None] = mapped_column(SmallInteger, nullable=True, comment='是否标定')
    is_overview_top_show: Mapped[int | None] = mapped_column(SmallInteger, nullable=True, comment='是否首页重点显示')
    is_home_page_show: Mapped[int | None] = mapped_column(SmallInteger, nullable=True, comment='是否首页显示')
    is_diagnose: Mapped[int | None] = mapped_column(SmallInteger, nullable=True, comment='是否启用诊断专家')
    is_upload: Mapped[int | None] = mapped_column(SmallInteger, nullable=True, comment='是否上传云平台')
    diagnosis_id: Mapped[str | None] = mapped_column(String(50), nullable=True, comment='关联诊断专家')

