package com.its.api.its.controller.vms;

import com.its.api.its.service.vms.TbVmsSymbLibVmp2Service;
import com.its.api.its.model.dto.vms.TbVmsSymbLibDto;
import com.its.api.its.model.dto.vms.TbVmsSymbLibIfscVMP2Dto;
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 = "12.VMS-1.정보 관리-4.VMS 소통정보 이미지 관리")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/vms/manager/symbl-vmp2")
public class TbVmsSymbLibVmp2Controller {

    private final TbVmsSymbLibVmp2Service service;

    @ApiOperation(value = "VMS 소통정보 이미지 전체조회(TB_VMS_SYMB_LIB)", response = TbVmsSymbLibDto.class)
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbVmsSymbLibDto> findAllSymbolImage() {
        return service.findAllSymbolImage();
    }

    @ApiOperation(value = "VMS 소통정보 이미지 개별조회(TB_VMS_SYMB_LIB)", response = TbVmsSymbLibIfscVMP2Dto.class)
    @GetMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbVmsSymbLibIfscVMP2Dto findById(@PathVariable final Integer id) {
        return this.service.findAllById(id);
    }

/*
    @ApiOperation(value = "VMS 소통정보 이미지 정보변경(TB_VMS_SYMB_LIB)", response = TbVmsSymbLibIfscVMP2Dto.class)
    @PutMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbVmsSymbLibDto updateById(@PathVariable final Integer id, @RequestBody @Valid final TbVmsSymbLibDto.TbVmsSymbLibUpdReq req) {
        return this.service.updateById(id, req);
    }
*/

    @ApiOperation(value = "VMS 소통정보 이미지 정보변경/생성-개별(TB_VMS_SYMB_LIB)", response = TbVmsSymbLibIfscVMP2Dto.class)
    @PostMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbVmsSymbLibIfscVMP2Dto mergeInfo(@PathVariable("id") Integer id, @RequestBody @Valid final TbVmsSymbLibIfscVMP2Dto.TbVmsSymbLibIfscVMP2UpdReq req) {
        return this.service.mergeSymbIfscInfo(req);
    }

    @ApiOperation(value = "VMS 소통정보 이미지 정보삭제-개별(TB_VMS_SYMB_LIB)", response = TbVmsSymbLibIfscVMP2Dto.class)
    @DeleteMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbVmsSymbLibDto deleteDataById(@PathVariable("id") Integer id) {
        return this.service.deleteDataById(id);
    }

/*
    @ApiOperation(value = "VMS 소통정보 이미지 정보변경/생성-목록(TB_VMS_SYMB_LIB)", response = TbVmsSymbLibDto.class)
    @PostMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbVmsSymbLibDto> mergeInfoList(@RequestBody @Valid final List<TbVmsSymbLibDto.TbVmsSymbLibUpdReq> listReq) {
        return this.service.mergeInfoList(listReq);
    }

    @ApiOperation(value = "VMS 소통정보 이미지 정보삭제-목록(TB_VMS_SYMB_LIB)", response = TbVmsSymbLibDto.class)
    @DeleteMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbVmsSymbLibDto> deleteDataByIds(@RequestBody @Valid final List<Integer> ids) {
        return this.service.deleteByIds(ids);
    }
*/

    @ApiOperation(value = "VMS 소통정보 이미지 사용여부 조회(TB_VMS_SYMB_LIB)", response = Integer.class)
    @GetMapping(value = "/usage/{id}", produces = {"application/json; charset=utf8"})
    public Integer findUsageCountBySymbolId(@PathVariable final Integer id) {
        return this.service.findUsageCountBySymbolId(id);
    }

    @ApiOperation(value = "VMS 소통정보 이미지 신규 ID 조회(TB_VMS_SYMB_LIB)", response = Integer.class)
    @GetMapping(value = "/new-id", produces = {"application/json; charset=utf8"})
    public Integer getNewSymbolId() {
        return this.service.getNewSymbolId();
    }

}
