package com.github.carlinhafuji.iotserver.application;

import com.github.carlinhafuji.iotserver.domain.Thing;
import com.github.carlinhafuji.iotserver.domain.ThingRepository;
import com.github.carlinhafuji.iotserver.domain.notification.Notification;
import com.github.carlinhafuji.iotserver.domain.notification.NotificationSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class EventProcessor {

    private final ThingRepository thingRepository;
    private final NotificationSender notificationSender;

    @Autowired
    public EventProcessor(ThingRepository thingRepository, NotificationSender notificationSender) {
        this.thingRepository = thingRepository;
        this.notificationSender = notificationSender;
    }

    public void processor(EventData eventData) {
        System.out.println(eventData.getThingId() + " - " + String.join(", " , eventData.getParams().keySet()));

        Thing thing = thingRepository().findOne(eventData.getThingId());

        System.out.print(thing);
        //Notification n = new Notification("titulo", "corpo", thing.getOwner())
        //notificationSender().send(n);
    }

    private ThingRepository thingRepository() {
        return thingRepository;
    }
    private NotificationSender notificationSender() {
        return notificationSender;
    }
}

@@ -49,16 +49,176 @@
 ation;%0A%0A
+import java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Service;%0A%0A
 import c
@@ -406,199 +406,14 @@
 tion
-;%0Aimport com.github.carlinhafuji.iotserver.domain.notification.NotificationSender;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Service
+Sender
 ;%0A%0A@
@@ -1176,24 +1176,176 @@
 nd(n);%0A    %7D
+%0A    %0A    private Map%3CString,String%3E thingMessage(Thing thing)%7B%0A    %09Map%3CString,String%3E msg = new HashMap%3CString,String%3E();%0A    %09%0A    %09return msg;%0A    %7D
 %0A%0A    privat

Add method thingMessage