package com.its.api.its.controller.management;

import com.its.api.its.model.dto.vms.TbVmsCmtrInfrDto;
import com.its.api.its.service.vms.TbVmsCmtrInfrService;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "00.교통상황관리-1.교통정보관리-1.현재소통정보조회-VMS정보제공구간")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/manage/traffic/current/vms")
public class TbVmsCmtrInfrController {

    private final TbVmsCmtrInfrService service;

    @ApiOperation(value = "VMS 소통정보 전체조회(TB_VMS_CMTRINFR)", response = TbVmsCmtrInfrDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbVmsCmtrInfrDto> findAll() {
        return service.findAll();
    }

    @ApiOperation(value = "VMS 소통정보 개별조회(TB_VMS_CMTRINFR)", response = TbVmsCmtrInfrDto.class)
    @GetMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbVmsCmtrInfrDto findById(
            @ApiParam(name = "id", value = "VMS정보제공구간 ID", example = "1", required = true)
            @PathVariable final Long id) {
        return this.service.findById(id);
    }

}
