using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model
{
    public class DeviceConfigModel
    {
        public Guid Id { get; set; }
        public string DeviceName { get; set; }
        public string DeviceType { get; set; }
        public string Remark { get; set; }
        public ICommunicationConfig CommunicationConfig { get; set; }

        public bool IsEnabled { get; set; }
    }
    public class TcpConfig : ICommunicationConfig
    {
        public string IPAddress { get; set; }
        public int Port { get; set; }
        public int ReadTimeout { get; set; }
        public int WriteTimeout { get; set; }
    }
    public class SerialPortConfig : ICommunicationConfig
    {
        public string COMPort { get; set; }
        public int BaudRate { get; set; }
        public int DataBit { get; set; } = 8;
        public StopBits StopBit { get; set; } = StopBits.One;
        public Parity ParityBit { get; set; } = Parity.None;
        public int ReadTimeout { get; set; }
        public int WriteTimeout { get; set; }
    }
    public interface ICommunicationConfig
    {
        int ReadTimeout { get; set; }
        int WriteTimeout { get; set; }
    }

}
