package com.its.op.controller.its.history;

import com.its.op.dto.its.oper.TbUserCnncHsDto;
import com.its.op.service.its.oper.TbUserCnncHsService;
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 = "02.이력조회-0.운영자접속이력")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/history/user-cnns-hs")
public class TbUserCnncHsController {

    private final TbUserCnncHsService service;

    @ApiOperation(value = "사용자접속이력 전체조회(TB_USERCNNC_HS)", response = TbUserCnncHsDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbUserCnncHsDto> findAllByDateRange(
            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20220119135000", required = true)
            @RequestParam String FROM_DT,
            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH24MI59)", example = "20220208122859", required = true)
            @RequestParam String TO_DT) {
        return service.findAllByDateRange(FROM_DT, TO_DT);
    }

}
