//
//  NotificationService.swift
//  SmartechNSE
//
//  Created by Jobin Kurian on 12/09/25.
//

import UserNotifications
import SmartPush
import Smartech


class NotificationService: SMTNotificationServiceExtension {
    
    var smartechServiceExtension: SMTNotificationServiceExtension?
    
    override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
        
        if SmartPush.sharedInstance().isNotification(fromSmartech: request.content.userInfo) {
            smartechServiceExtension = SMTNotificationServiceExtension()
            smartechServiceExtension?.didReceive(request, withContentHandler: contentHandler)
        }
    }
    
    override func serviceExtensionTimeWillExpire() {
        // Called just before the extension will be terminated by the system.
        // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
        smartechServiceExtension?.serviceExtensionTimeWillExpire()
    }
}
