// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

namespace PVDEMCS.Services.Models;

/// <summary>
/// PLC点位
/// </summary>
public partial class DevicePoint
{
    public string Id { get; set; }

    /// <summary>
    /// 控制器Id
    /// </summary>
    public string DeviceId { get; set; }

    /// <summary>
    /// 控制器编号
    /// </summary>
    public string DeviceCode { get; set; }

    /// <summary>
    /// 控制器名称
    /// </summary>
    public string DeviceName { get; set; }

    /// <summary>
    /// 设备编码
    /// </summary>
    public string EquipmentId { get; set; }

    /// <summary>
    /// 设备编码
    /// </summary>
    public string EquipmentCode { get; set; }

    /// <summary>
    /// 设备名称
    /// </summary>
    public string EquipmentName { get; set; }

    /// <summary>
    /// 设备类型：Ionbond，Balzers，Cemecon
    /// </summary>
    public string EquipmentType { get; set; }

    /// <summary>
    /// 点位所属动作，启动停止：start_stop；故障：fault
    /// </summary>
    public string ActionType { get; set; }

    /// <summary>
    /// 点位编号
    /// </summary>
    public string PointCode { get; set; }

    /// <summary>
    /// 点位名称
    /// </summary>
    public string PointName { get; set; }

    /// <summary>
    /// S7 数据存储地址，直连 存储区地址
    /// </summary>
    public string Address { get; set; }

    /// <summary>
    /// 字段类型
    /// </summary>
    public string DataType { get; set; }

    /// <summary>
    /// PLC 点位是否启用 (1 启用, 0 禁用)
    /// </summary>
    public bool Activated { get; set; }


    /// <summary>
    /// 模式：Auto 自动；Manual手动
    /// </summary>
    public String Model { get; set; }

    /// <summary>
    /// 是否报警：true 报警；false 不报警（为Auto)
    /// </summary>
    public bool IsAlarm { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    public string Remark { get; set; }

    public Object ObjectValue { get; set; }

    public T GetValue<T>()
    {
        if (ObjectValue is T)
        {
            return (T)ObjectValue;
        }
        return default;
    }

}