using System;
using JiShe.CollectBus.Interfaces;
using Volo.Abp.Domain.Entities;

namespace JiShe.CollectBus.IotSystems.Protocols
{
    public class ProtocolInfo : AggregateRoot<Guid>, IProtocolInfo
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="baseProtocol"></param>
        /// <param name="type"></param>
        /// <param name="description"></param>
        /// <param name="regularExpression"></param>
        public ProtocolInfo(string name, string baseProtocol, string type, string description, string regularExpression)
        {
            Code = $"PL-{DateTime.Now:yyyyMMddHHmmss}";
            Name = name;
            Type = type;
            Description = description;
            RegularExpression = regularExpression;
            BaseProtocol = baseProtocol;
        }

        /// <summary>
        /// 协议编码，唯一识别
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        ///     协议名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        ///     基础协议 376.1/645
        /// </summary>
        public string BaseProtocol { get; set; }

        /// <summary>
        ///     协议类型 TCP/UDP
        /// </summary>
        public string Type { get; set; }

        /// <summary>
        ///     协议备注
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        ///     型号正则匹配
        /// </summary>
        public string RegularExpression { get; set; }
    }
}