package llc.arma.fleet.monitor.presentation.graphql

import llc.arma.fleet.monitor.domain.service.FleetReportService
import llc.arma.fleet.monitor.presentation.model.FleetDailyReport
import llc.arma.fleet.monitor.presentation.model.GenerateFleetDailyReportPayload
import llc.arma.fleet.monitor.presentation.model.ReportFile
import org.springframework.graphql.data.method.annotation.Argument
import org.springframework.graphql.data.method.annotation.QueryMapping
import org.springframework.stereotype.Controller
import java.time.LocalDate

@Controller
class FleetReportGraphQlController(
    private val fleetReportService: FleetReportService,
) {
    @QueryMapping
    fun getFleetDailyReport(@Argument date: LocalDate): FleetDailyReport = fleetReportService.getFleetDailyReport(date)

    @QueryMapping
    fun createFleetDailyReportDownloadUrl(@Argument payload: GenerateFleetDailyReportPayload): ReportFile =
        fleetReportService.createFleetDailyReportDownloadUrl(payload)
}
