using SqlSugar;
using SqlSugar.DbConvert;
using S7.Net;
using DMS.Core.Enums;
using DMS.Infrastructure.Entities;
///
/// 表示数据库中的设备实体。
///
[SugarTable("Device")]
public class DbDevice
{
///
/// 设备的描述信息。
///
[SugarColumn(IsNullable = true)]
public string? Description { get; set; }
///
/// 设备的类型。
///
[SugarColumn(ColumnDataType = "varchar(20)", SqlParameterDbType = typeof(EnumToStringConvert))]
public DeviceType DeviceType { get; set; }
///
/// 设备的唯一标识符。
///
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)] //数据库是自增才配自增
public int Id { get; set; }
///
/// 设备的IP地址。
///
public string Ip { get; set; }
///
/// 表示设备是否处于活动状态。
///
public bool IsActive { get; set; }
///
/// 表示设备是否正在运行。
///
public bool IsRuning { get; set; }
///
/// 设备的名称。
///
public string Name { get; set; }
///
/// 设备的端口号。
///
public int Prot { get; set; }
///
/// PLC的CPU类型。
///
[SugarColumn(ColumnDataType = "varchar(20)", IsNullable = true, SqlParameterDbType = typeof(EnumToStringConvert))]
public CpuType CpuType { get; set; }
///
/// PLC的机架号。
///
[SugarColumn(IsNullable = true)]
public short Rack { get; set; }
///
/// PLC的槽号。
///
/// [SugarColumn(IsNullable = true)]
public short Slot { get; set; }
///
/// 设备的通信协议类型。
///
[SugarColumn(ColumnDataType = "varchar(20)", SqlParameterDbType = typeof(EnumToStringConvert))]
public ProtocolType ProtocolType { get; set; }
///
/// OPC UA Endpoint URL。
///
[SugarColumn(IsNullable = true)]
public string? OpcUaEndpointUrl { get; set; }
///
/// 设备关联的变量表列表。
///
[Navigate(NavigateType.OneToMany, nameof(DbVariableTable.DeviceId))]
[SugarColumn(IsNullable = true)]
public List? VariableTables { get; set; }
}