package vn.azteam.tpf.service.dto;

import com.google.firebase.messaging.FirebaseMessagingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import vn.azteam.tpf.service.FCMService;
import vn.azteam.tpf.service.UserService;

import java.util.concurrent.ExecutionException;

@Service
public class PushNotificationService {

    private Logger logger = LoggerFactory.getLogger(PushNotificationService.class);
    private FCMService fcmService;
    private UserService userService;

    public PushNotificationService(FCMService fcmService, UserService userService) {
        this.userService = userService;
        this.fcmService = fcmService;
    }

    public void sendPushNotificationToToken(PushNotificationRequest request) {
        try {
            fcmService.sendMessageToToken(request);
        } catch (FirebaseMessagingException e) {
            logger.error(e.getMessage());
        }
    }
}
