package com.ffii.fpsms.modules.monitoring.scheduler

import com.ffii.fpsms.modules.monitoring.service.ClientPresenceService
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.scheduling.annotation.Scheduled
import org.springframework.stereotype.Component

@Component
@ConditionalOnProperty(prefix = "fpsms.monitoring", name = ["enabled"], havingValue = "true")
class ClientPresenceOfflineScanner(
    private val clientPresenceService: ClientPresenceService,
) {
    @Scheduled(fixedRateString = "\${fpsms.client-presence.offline-scan-interval-ms:60000}")
    fun scanStaleOffline() {
        clientPresenceService.recordStaleOfflineEvents()
    }
}
