package com.its.op.controller.its.database;

import com.its.op.dto.its.oper.TbUserGropMenuAthrDto;
import com.its.op.service.its.oper.TbUserGropMenuAthrService;
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.기초데이터관리-13.운영자그룹메뉴관리")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/database/grop-menu-athr")
public class TbUserGropMenuAthrController {

    private final TbUserGropMenuAthrService service;

    @ApiOperation(value = "운영자그룹메뉴 전체조회(TB_GROP_MENU_ATHR)", response = TbUserGropMenuAthrDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbUserGropMenuAthrDto> findAll() {
        return service.findAll();
    }

   /* @ApiOperation(value = "그룹-메뉴권한 개별조회(TB_GROP_MENU_ATHR)", response = TbGropMenuAthrDto.class)
    @GetMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbGropMenuAthrDto findById(@PathVariable final TbGropMenuAthrKey id) {
        return this.service.findById(id);
    }
*/
    @ApiOperation(value = "그룹-메뉴권한 정보변경/생성-목록(TB_GROP_MENU_ATHR)", response = TbUserGropMenuAthrDto.class, responseContainer = "ArrayList")
    @PostMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbUserGropMenuAthrDto> mergeInfoList(@RequestBody @Valid final List<TbUserGropMenuAthrDto.TbUserGropMenuAthrUpdReq> req) {
        return this.service.mergeInfoList(req);
    }

}
