package com.remax.notification.newUtil.events

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.remax.notification.check.NotificationCheckController
import com.remax.notification.timing.NotificationTimingController

class PowerConnectionReceiver : BroadcastReceiver() {
    override fun onReceive(context: Context, intent: Intent) {
        when (intent.action) {
            Intent.ACTION_POWER_CONNECTED -> {
                NotificationTimingController.getInstance()
                    .triggerNotificationIfAllowed(NotificationCheckController.NotificationType.CHARGE)
            }
            Intent.ACTION_POWER_DISCONNECTED -> {
                NotificationTimingController.getInstance()
                    .triggerNotificationIfAllowed(NotificationCheckController.NotificationType.CHARGE)
            }
        }
    }
}