package space.nstart.pcp.tle_monitoring_service.controller

import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PutMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import space.nstart.pcp.tle_monitoring_service.service.TlePollingSettingsService
import space.nstart.pcp.tle_monitoring_service.service.UpdateTlePollingSettingsRequest

@RestController
@RequestMapping("v1/api/tle/polling-settings")
class TlePollingSettingsController(
    private val pollingSettingsService: TlePollingSettingsService,
) {

    @GetMapping
    fun current() = pollingSettingsService.current()

    @PutMapping
    fun update(@RequestBody request: UpdateTlePollingSettingsRequest) =
        pollingSettingsService.update(request)
}
