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

import com.its.api.its.model.dto.link.TbLinkTrafDto;
import com.its.api.its.service.link.TbLinkTrafService;
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/link")
public class TbLinkTrafController {

    private final TbLinkTrafService service;

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

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

}
