package com.its.op.controller.its.statistics;

import com.its.op.dto.its.unit.TbUnitSystSttsHsStatDto;
import com.its.op.service.its.unit.TbUnitSystSttsHsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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 java.util.List;

@Api(tags = "03.통계-6.프로세스상태통계")
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/statistics/unit-syst-stts")
public class TbUnitSystSttsHsStatController {

    private final TbUnitSystSttsHsService service;

    @ApiOperation(value = "프로세스상태통계조회", response = TbUnitSystSttsHsStatDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbUnitSystSttsHsStatDto> findAllStatByDateRange(
            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20220120155759", required = true)
            @RequestParam String FROM_DT,
            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH24MI59)", example = "20220224112028", required = true)
            @RequestParam String TO_DT) {

        return this.service.findAllStatByDateRange(FROM_DT, TO_DT);
    }

}
