using BPA.Message;
using BPA.Message.Enum;
using BPASmartClient.Model;
using BPASmartClient.Peripheral;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Device
{
    /// <summary>
    /// 设备接口
    /// </summary>
    public interface IDevice
    {
        /// <summary>
        /// 设备ID
        /// </summary>
        int DeviceId { get; set; }
        /// <summary>
        /// 设备名称
        /// </summary>
        string Name { get; set; }
        /// <summary>
        /// 设备类型
        /// </summary>
        DeviceClientType DeviceType { get; }

        /// <summary>
        /// 订单物料信息
        /// </summary>
        //OrderMaterialDelivery orderMaterialDelivery { get; set; }

        /// <summary>
        /// 配方数据信息
        /// </summary>
        //RecipeBoms recipeBoms { get; set; }

        /// <summary>
        /// 设备所有状态
        /// </summary>
        DeviceStatus Status { get; set; }
        /// <summary>
        /// 运行日志
        /// </summary>
        public List<object> Log { get; set; }
        /// <summary>
        /// 运行告警
        /// </summary>
        public List<object> Error { get; set; }
        /// <summary>
        /// 设备变量信息
        /// </summary>
        List<VariableMonitor> variableMonitors { get; set; }

        /// <summary>
        /// 设备报警信息集合
        /// </summary>
        List<Alarm> alarms { get; set; }

        /// <summary>
        /// 接口报警对象
        /// </summary>
        IAlarm InterfaceAlarm { get; set; }

        /// <summary>
        /// 报警实体
        /// </summary>
        AlarmHelper alarmHelper { get; set; }

        /// <summary>
        /// 是否忙碌
        /// </summary>
        bool IsBusy { get; }
        /// <summary>
        /// 是否健康
        /// </summary>
        bool IsHealth { get; }
        /// <summary>
        /// 初始化设备加载
        /// </summary>
        void Initliaze(List<IPeripheral> peripherals);
        /// <summary>
        /// 开启设备主任务
        /// </summary>
        void StartMain();
        /// <summary>
        /// 设备停止
        /// </summary>
        void Stop();
        /// <summary>
        /// 获取错误信息
        /// </summary>
        object GetError();
        /// <summary>
        /// 获取日志信息
        /// </summary>
        object GetLog();
        /// <summary>
        /// 获取硬件信息
        /// </summary>
        object GetVariableMonitor();
        /// <summary>
        /// 获取属性变量
        /// </summary>
        /// <param name="info"></param>
        /// <param name="field"></param>
        object GetPropertyValue(object info, string field);

        Action<int, object> AddErrorAction { get; set; }
        Action<int, object> DeleteErrorAction { get; set; }
    }
}
