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

import com.its.api.its.model.dto.oper.TbGropMenuAthrDto;
import com.its.api.its.service.oper.TbGropMenuAthrService;
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 TbGropMenuAthrController {

    private final TbGropMenuAthrService service;

    @ApiOperation(value = "운영자그룹메뉴 전체조회(TB_GROP_MENU_ATHR)", response = TbGropMenuAthrDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbGropMenuAthrDto> 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 = TbGropMenuAthrDto.class, responseContainer = "ArrayList")
    @PostMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbGropMenuAthrDto> mergeInfoList(@RequestBody @Valid final List<TbGropMenuAthrDto.TbGropMenuAthrUpdReq> req) {
        return this.service.mergeInfoList(req);
    }

}
