package com.spring.domain.schedule.api;

import java.util.List;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.spring.domain.schedule.dto.BatchChartResponse;
import com.spring.domain.schedule.dto.RecentJobResponse;
import com.spring.domain.schedule.service.BatchChartService;
import com.spring.domain.schedule.service.DashBoardJobService;

import lombok.RequiredArgsConstructor;

@RequestMapping("/api/dashboard")
@RestController
@RequiredArgsConstructor
public class DashBoardApi {

    private final BatchChartService batchChartService;
    private final DashBoardJobService dashBoardJobService;

    @GetMapping("/chart")
    public BatchChartResponse getBatchJobExecutionData(@RequestParam int year, @RequestParam int month) {
        return batchChartService.getBatchJobExecutionData(year, month);
    }

    @GetMapping("/recent-job")
    public List<RecentJobResponse> getRecentJobs() {
        return dashBoardJobService.getRecentJobs();
    }

}
