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

from sqlalchemy import Integer, String, Text, DateTime
from sqlalchemy.orm import Mapped, mapped_column

from app.core.base_model import ModelMixin, UserMixin


class GatewayModel(ModelMixin):
    """
    网关信息表
    """
    __tablename__: str = 'biz_gateway'
    __table_args__: dict[str, str] = {'comment': '网关信息'}
    __loader_options__: list[str] = ["created_by", "updated_by"]

    crane_no: Mapped[str | None] = mapped_column(String(200), nullable=True, comment='行车编号')
    gateway_name: Mapped[str | None] = mapped_column(String(200), nullable=True, comment='网关名称')
    gateway_type: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='网关类型')
    gateway_ipaddress: Mapped[str | None] = mapped_column(String(200), nullable=True, comment='网关IP地址 ')
    gateway_port: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='网关端口 ')
    plc_brand: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='PLC品牌')
    plc_model: Mapped[str | None] = mapped_column(String(200), nullable=True, comment='PLC型号 ')
    serial_port_name: Mapped[str | None] = mapped_column(String(255), nullable=True, comment='端口号')
    serial_baud_rate: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='波特率 ')
    serial_data_bits: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='数据位 5678')
    serial_stop_bits: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='停止位 ')
    serial_parity: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='检验位 ')

