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

import com.its.api.its.model.dto.link.TbLinkSyopTrafDto;
import com.its.api.its.model.dto.link.TbLinkSyopTrafKeyDto;
import com.its.api.its.service.link.TbLinkSyopTrafService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@Api(tags = "00.교통상황관리-1.교통정보관리-2.소통정보 제보관리")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/manage/traffic/syop_traf")
public class TbLinkSyopTrafController {

    private final TbLinkSyopTrafService service;

    @ApiOperation(value = "링크 운영자 소통상황 전체조회-현재(TB_LINK_SYOP_TRAF)", response = TbLinkSyopTrafDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbLinkSyopTrafDto> findAllCurrent() {
        return service.findAllCurrent();
    }

    @ApiOperation(value = "링크 운영자 소통상황 정보변경/생성-목록(TB_LINK_SYOP_TRAF)", response = TbLinkSyopTrafDto.class, responseContainer = "ArrayList")
    @PostMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbLinkSyopTrafDto> mergeInfoList(@RequestBody @Valid final List<TbLinkSyopTrafDto.TbLinkSyopTrafUpdReq> listReq) {
        return this.service.mergeInfoList(listReq);
    }

    @ApiOperation(value = "링크 운영자 소통상황 정보삭제-목록(TB_LINK_SYOP_TRAF)", response = TbLinkSyopTrafKeyDto.class, responseContainer = "ArrayList")
    @DeleteMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbLinkSyopTrafDto> deleteDataByIds(
            @RequestBody @Valid final List<TbLinkSyopTrafKeyDto> ids) {
        return this.service.deleteByIds(ids);
    }

}
