using NBC.Network;
using NBC.Network.Interface;

namespace NBC;

public static class NetMessageDelegate
{
    public static event Action<Session, Type, object, uint, uint>? OnMessage;

    public static event Action<IRequest, long> OnRequest;

    public static event Action<IResponse> OnResponse;
    
    //(IRequest request, long routeId = 0)
    public static void Message(Session session, Type type, object message, uint rpcId, uint protocolCode)
    {
        OnMessage?.Invoke(session, type, message, rpcId, protocolCode);
    }

    public static void Request(IRequest request, long routeId = 0)
    {
        OnRequest?.Invoke(request, routeId);
    }
    
    public static void Response(IResponse response)
    {
        OnResponse?.Invoke(response);
    }
}