package com.its.op.controller.its.vms;

import com.its.op.dto.its.vms.TbVmsDsplHsDto;
import com.its.op.dto.its.vms.TbVmsDsplHsImageDto;
import com.its.op.service.its.vms.TbVmsDsplHsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
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 = "12.VMS-4.이력조회-2.표출이력조회")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/vms/history/dspl")
public class TbVmsDsplHsController {

    private final TbVmsDsplHsService service;

    @ApiOperation(value = "VMS 표출 이력 조회-목록(TB_VMS_DSPL_HS)", response = TbVmsDsplHsDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbVmsDsplHsDto> findAllByDateRange(
            @ApiParam(name = "id", value = "VMS 관리번호 목록", example = "[10014,10015]", required = true)
            @RequestParam List<Long> id,
            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20210112152000", required = true)
            @RequestParam String FROM_DT,
            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH24MI59)", example = "20221112152000", required = true)
            @RequestParam String TO_DT
    ) {
        return this.service.findAllByDateRange(FROM_DT, TO_DT, id);
    }

    @ApiOperation(value = "VMS 표출 이력 조회-이미지(TB_VMS_DSPL_HS)", response = TbVmsDsplHsImageDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/images", produces = {"application/json; charset=utf8"})
    public List<TbVmsDsplHsImageDto> findAllImageByDateRange(
            @ApiParam(name = "id", value = "VMS 관리번호", example = "10016", required = true)
            @RequestParam Long id,
            @ApiParam(name = "DSPL_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20220302151210", required = true)
            @RequestParam String DSPL_DT
    ) {
        return this.service.findAllImageByDateRange(id, DSPL_DT);
    }

}
