using System.Collections.Generic;
using System.IO.Ports;
using ChuPiao.AutoPrint.Machine.Models;
using ChuPiao.Common.Enums;
using ChuPiao.Common.Models;
using log4net;

namespace ChuPiao.AutoPrint.Machine
{
    public enum VirtualKeyboardStatus
    {
        Running,
        Stopping,
        Stopped,
        Exception
    }
    /// <summary>
    /// 模拟键盘（键盘线）接口
    /// </summary>
    public interface IVirtualKeyboard
    {
        #region 属性
        /// <summary>
        /// 键盘状态
        /// </summary>
        VirtualKeyboardStatus Status { get; set; }

        /// <summary>
        /// 日志记录器
        /// </summary>
        ILog Log { get; set; }

        /// <summary>
        /// 端口
        /// </summary>
        SerialPort KeyboardPort { get; set; }
        /// <summary>
        /// 键盘类型
        /// </summary>
        KeyboardType KeyboardType { get; set; }

        /// <summary>
        /// 键码词典
        /// </summary>
        SortedDictionary<string, M_KeycodeConfigEntity> KeycodeDictionary { get; set; }

        /// <summary>
        /// 屏保清除键
        /// </summary>
        KeycodeInfo ClearScreenSaverKeycode { get; set; }

        /// <summary>
        /// 等待发送的键码队列
        /// </summary>
        Queue<KeycodeInfo> WaitSendKeycodeQueue { get; set; }

        /// <summary>
        /// 彩票机相关信息
        /// </summary>
        M_MachineEntity MachineInfo { get; set; }

        /// <summary>
        /// 端口号
        /// </summary>
        string Port { get; set; }
        /// <summary>
        /// 端口波特率
        /// </summary>
        int PortBps { get; set; }

        /// <summary>
        /// 是否发送
        /// </summary>
        bool IsSend { get; set; }

        #endregion

        #region 方法
        /// <summary>
        /// 初始化
        /// </summary>
        void Initialize();

        /// <summary>
        /// 启动
        /// </summary>
        void Start();

        /// <summary>
        /// 停止
        /// </summary>
        void Stop();

        /// <summary>
        /// 输入键码
        /// </summary>
        void Input(List<KeycodeInfo> keycodeInfo);

        #endregion
    }
}
