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

import com.its.api.its.model.dto.ifsc.TbIfscTrafDto;
import com.its.api.its.service.ifsc.TbIfscTrafService;
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/ifsc")
public class TbIfscTrafController {

    private final TbIfscTrafService service;

    @ApiOperation(value = "정보제공구간 소통상황 전체조회(TB_IFSC_TRAF)", response = TbIfscTrafDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbIfscTrafDto> findAll() {
        return service.findAll();
    }

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

}
