package com.its.api.its.controller.database;

import com.its.api.its.model.dto.code.TbCmtrGradClsfDto;
import com.its.api.its.service.code.TbCmtrGradClsfService;
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 = "09.기초데이터관리-07.소통등급관리")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/database/cmtr-grad-clsf")
public class TbCmtrGradClsfController {

    private final TbCmtrGradClsfService service;

    @ApiOperation(value = "소통 등급 분류 전체조회(TB_CMTR_GRAD_CLSF)", response = TbCmtrGradClsfDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbCmtrGradClsfDto> findAll() {
        return service.findAll();
    }

    @ApiOperation(value = "소통 등급 분류 정보변경/생성-목록(TB_CMTR_GRAD_CLSF)", response = TbCmtrGradClsfDto.class, responseContainer = "ArrayList")
    @PostMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbCmtrGradClsfDto> mergeInfoList(@RequestBody @Valid final List<TbCmtrGradClsfDto.TbCmtrGradClsfUpdReq> req) {
        return this.service.mergeInfoList(req);
    }

}
