import asyncio

from defence360agent.rpc_tools.lookup import (
    RootEndpoints,
    bind,
)
from defence360agent.utils import Scope
from imav.api.rpc import Protocol


class MalwareEvents(RootEndpoints):
    SCOPE = Scope.IM360

    @bind("malware", "generic", "event")
    async def generic_event(self, **kwargs):
        loop = asyncio.get_event_loop()
        proto = Protocol(loop, self._sink)
        proto._process_msg(kwargs)
