package com.its.op.controller.its.rse;

import com.its.op.dto.its.rse.TbRseObuClctStatDdDto;
import com.its.op.entity.its.rse.TbRseObuClctStatDdKey;
import com.its.op.service.its.rse.TbRseObuClctStatDdService;
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 = "14.RSE-1.RSE 관리-RSE OBU 수집 일 통계")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/rse/tb_rse_obu_clct_stat_dd")
public class TbRseObuClctStatDdController {

    private final TbRseObuClctStatDdService service;

    @ApiOperation(value = "RSE OBU 수집 일 통계 전체조회(TB_RSE_OBU_CLCT_STAT_DD)", response = TbRseObuClctStatDdDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbRseObuClctStatDdDto> findAll() {
        return this.service.findAll();
    }

    @ApiOperation(value = "RSE OBU 수집 일 통계 개별조회(TB_RSE_OBU_CLCT_STAT_DD)", response = TbRseObuClctStatDdDto.class)
    @GetMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbRseObuClctStatDdDto findById(@PathVariable final TbRseObuClctStatDdKey id) {
        return this.service.findById(id);
    }

    @ApiOperation(value = "RSE OBU 수집 일 통계 정보변경(TB_RSE_OBU_CLCT_STAT_DD)", response = TbRseObuClctStatDdDto.class)
    @PutMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbRseObuClctStatDdDto updateById(@PathVariable final TbRseObuClctStatDdKey id, @RequestBody @Valid final TbRseObuClctStatDdDto.TbRseObuClctStatDdUpdReq req) {
        return this.service.updateById(id, req);
    }

    @ApiOperation(value = "RSE OBU 수집 일 통계 정보변경/생성-목록(TB_RSE_OBU_CLCT_STAT_DD)", response = TbRseObuClctStatDdDto.class, responseContainer = "ArrayList")
    @PostMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbRseObuClctStatDdDto> mergeInfoList(@RequestBody @Valid final List<TbRseObuClctStatDdDto.TbRseObuClctStatDdUpdReq> listReq) {
        return this.service.mergeInfoList(listReq);
    }

    @ApiOperation(value = "RSE OBU 수집 일 통계 정보변경/생성-개별(TB_RSE_OBU_CLCT_STAT_DD)", response = TbRseObuClctStatDdDto.class)
    @PostMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbRseObuClctStatDdDto mergeInfo(@PathVariable("id") TbRseObuClctStatDdKey id, @RequestBody @Valid final TbRseObuClctStatDdDto.TbRseObuClctStatDdUpdReq req) {
        return this.service.mergeInfo(req);
    }

    @ApiOperation(value = "RSE OBU 수집 일 통계 정보삭제-개별(TB_RSE_OBU_CLCT_STAT_DD)", response = TbRseObuClctStatDdDto.class)
    @DeleteMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbRseObuClctStatDdDto deleteDataById(@PathVariable("id") TbRseObuClctStatDdKey id) {
        return this.service.deleteById(id);
    }

    @ApiOperation(value = "RSE OBU 수집 일 통계 정보삭제-목록(TB_RSE_OBU_CLCT_STAT_DD)", response = TbRseObuClctStatDdDto.class, responseContainer = "ArrayList")
    @DeleteMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbRseObuClctStatDdDto> deleteDataByIds(@RequestBody @Valid final List<TbRseObuClctStatDdKey> ids) {
        return this.service.deleteByIds(ids);
    }

}
