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

namespace BPASmartClient.Device
{
    /// <summary>
    /// 设备基类
    /// </summary>
    public abstract class BaseDevice : IDevice
    {
        /// <summary>
        /// 设备ID
        /// </summary>
        public int DeviceId { get; set; }
        /// <summary>
        /// 设备所有状态
        /// </summary>
        public DeviceStatus Status { get; set; }
        /// <summary>
        /// 设备名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 设备类型
        /// </summary>
        public abstract DeviceClientType DeviceType { get; }
        /// <summary>
        /// 是否忙碌
        /// </summary>
        public bool IsBusy { get;protected set; }
        /// <summary>
        /// 是否健康
        /// </summary>
        public bool IsHealth { get; protected set; }

        public void Initliaze()
        {
        }

        public void Initliaze(List<IPeripheral> peripherals)
        {
            peripherals.ForEach(p => {
                p.DeviceId = this.DeviceId;
                p.Init();
            });
        }

        public abstract void StartMain();

        public abstract void Stop();
    }
}
