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

import com.its.api.its.model.dto.road.TbRoadTrafDto;
import com.its.api.its.service.road.TbRoadTrafService;
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.현재소통정보조회-도로")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/manage/traffic/current/road")
public class TbRoadTrafController {

    private final TbRoadTrafService service;

    @ApiOperation(value = "도로 소통상황 전체조회(TB_ROAD_TRAF)", response = TbRoadTrafDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbRoadTrafDto> findAll() {
        return service.findAll();
    }

    @ApiOperation(value = "도로 소통상황 개별조회(TB_ROAD_TRAF)", response = TbRoadTrafDto.class)
    @GetMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbRoadTrafDto findById(
            @ApiParam(name = "id", value = "도로 ID", example = "3200000011", required = true)
            @PathVariable final Long id) {
        return this.service.findById(id);
    }

}
