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

import com.its.op.dto.its.vms.TbVmsIfscDto;
import com.its.op.dto.its.vms.TbVmsRltnIfscDto;
import com.its.op.service.its.vms.TbVmsRltnIfscService;
import com.its.op.service.its.vms.TbVmsIfscService;
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.정보 관리-2.VMS 정보제공구간 설정")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/vms/manager/vms-ifsc-rltn")
public class TbVmsRltnIfscController {

    private final TbVmsRltnIfscService service;
    private final TbVmsIfscService vmsIfscService;

    @ApiOperation(value = "VMS 정보제공구간 목록 조회(TB_VMS_CTLR)", response = TbVmsRltnIfscDto.class)
    @GetMapping(value = "/vms-ifsc", produces = {"application/json; charset=utf8"})
    public List<TbVmsIfscDto> findVmsIfscAll() {
        return vmsIfscService.findAll();
    }

    @ApiOperation(value = "VMS 정보제공구간 관계 전체조회(TB_VMS_IFSC_RLTN)", response = TbVmsRltnIfscDto.class)
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbVmsRltnIfscDto> findAll() {
        return service.findAll();
    }

    @ApiOperation(value = "도형식 VMS 정보제공구간 관계 전체조회(TB_VMS_IFSC_RLTN)", response = TbVmsRltnIfscDto.class)
    @GetMapping(value = "/figure", produces = {"application/json; charset=utf8"})
    public List<TbVmsRltnIfscDto> findAllFigure() {
        return service.findAllFigure();
    }

    @ApiOperation(value = "VMS 정보제공구간 관계 개별조회(TB_VMS_IFSC_RLTN)", response = TbVmsRltnIfscDto.class)
    @GetMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public List<TbVmsRltnIfscDto> findDataById(@PathVariable("id") final Long vmsCtlrNmbr) {
        return this.service.findDataById(vmsCtlrNmbr);
    }

/*
    @ApiOperation(value = "VMS 정보제공구간 관계 정보변경(TB_VMS_IFSC_RLTN)", response = TbVmsIfscRltnDto.class)
    @PutMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbVmsIfscRltnDto updateById(@PathVariable final TbVmsIfscRltnKey id, @RequestBody @Valid final TbVmsIfscRltnDto.TbVmsIfscRltnUpdReq req) {
        return this.service.updateById(id, req);
    }
*/

    @ApiOperation(value = "VMS 정보제공구간 관계 정보변경/생성-개별(TB_VMS_IFSC_RLTN)", response = TbVmsRltnIfscDto.class)
    @PostMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbVmsRltnIfscDto.TbVmsIfscRltnUpdReq mergeInfo(
            @PathVariable("id") Long id, @RequestBody @Valid final TbVmsRltnIfscDto.TbVmsIfscRltnUpdReq req) {
        return this.service.mergeInfo(req);
    }

/*
    @ApiOperation(value = "VMS 정보제공구간 관계 정보변경/생성-목록(TB_VMS_IFSC_RLTN)", response = TbVmsIfscRltnDto.class)
    @PostMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbVmsIfscRltnDto> mergeInfoList(@RequestBody @Valid final List<TbVmsIfscRltnDto.TbVmsIfscRltnUpdReq> listReq) {
        return this.service.mergeInfoList(listReq);
    }

    @ApiOperation(value = "VMS 정보제공구간 관계 정보삭제-목록(TB_VMS_IFSC_RLTN)", response = TbVmsIfscRltnDto.class)
    @DeleteMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbVmsIfscRltnDto> deleteDataByIds(@RequestBody @Valid final List<TbVmsIfscRltnKey> ids) {
        return this.service.deleteByIds(ids);
    }

    @ApiOperation(value = "VMS 정보제공구간 관계 정보삭제-개별(TB_VMS_IFSC_RLTN)", response = TbVmsIfscRltnDto.class)
    @DeleteMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbVmsIfscRltnDto deleteDataById(@PathVariable("id") TbVmsIfscRltnKey id) {
        return this.service.deleteById(id);
    }
*/

}
