using System;
using System.Threading.Tasks;
using JiShe.CollectBus.Common.Models;
using JiShe.CollectBus.IotSystems.MessageReceiveds;
using JiShe.CollectBus.IotSystems.Protocols;
using JiShe.CollectBus.Protocol.Models;
using TouchSocket.Sockets;

namespace JiShe.CollectBus.Protocol.Interfaces
{
    public interface IProtocolPlugin
    {
        Task<ProtocolInfo> GetAsync();

        Task LoadAsync();

        Task<T> AnalyzeAsync<T>(ITcpSessionClient client, string messageReceived, Action<T>? sendAction = null) where T : class;

        /// <summary>
        /// 组装报文
        /// </summary>
        /// <typeparam name="T">是否需要转发的扩展协议入参对象</typeparam>
        /// <param name="afnFnCode">映射读取执行方法的Code，例如10_1，表示10H_F1</param>
        /// <returns></returns>
        Task<ProtocolBuildResponse> BuildAsync(ProtocolBuildRequest request);
    }
}
