package com.its.op.controller.its.vms;

import com.its.op.dto.its.common.NewIdIntegerDto;
import com.its.op.dto.its.common.UsageCountDto;
import com.its.op.dto.its.vms.TbVmsSymbLibDto;
import com.its.op.service.its.vms.TbVmsSymbLibSbt3Service;
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.정보 관리-6.VMS 동영상 관리")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/vms/manager/symb-sbt3")
public class TbVmsSymbLibSbt3Controller {

    private final TbVmsSymbLibSbt3Service 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 = TbVmsSymbLibDto.class)
    @GetMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbVmsSymbLibDto findById(@PathVariable final Integer id) {
        return this.service.findById(id);
    }

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

    @ApiOperation(value = "VMS 심벌이미지 정보삭제-개별(TB_VMS_SYMB_LIB)", response = TbVmsSymbLibDto.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 = UsageCountDto.class)
    @GetMapping(value = "/usage/{id}", produces = {"application/json; charset=utf8"})
    public UsageCountDto findUsageCountBySymbolId(@PathVariable final Integer id) {
        return this.service.findUsageCountBySymbolId(id);
    }

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

}
