package com.its.op.controller.its.scrs;

import com.its.op.dto.its.scrs.TbScSgnlIxrOperHsDto;
import com.its.op.service.its.scrs.TbScSgnlIxrOperHsService;
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.*;

import java.util.List;

@Api(tags = "14.스마트교차로-3.이력-1.신호교차로운영이력")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/scrs/history/sgnl/history")
public class TbScSgnlIxrOperHsController {

    private final TbScSgnlIxrOperHsService service;

    @ApiOperation(value = "신호교차로운영이력조회", response = TbScSgnlIxrOperHsDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/{sgnlIxrNmbr}", produces = {"application/json; charset=utf8"})
    public List<TbScSgnlIxrOperHsDto> findAllByDateRange(
            @PathVariable("sgnlIxrNmbr") final Integer sgnlIxrNmbr,
            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH240000)", example = "20210112150000", required = true)
            @RequestParam String FROM_DT,
            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH245959)", example = "20221112155959", required = true)
            @RequestParam String TO_DT) {
        return this.service.findAllByDateRange(sgnlIxrNmbr, FROM_DT, TO_DT);
    }

}
