package com.its.op.controller.its.facility;

import com.its.op.dto.its.facility.TbFcltSttsAlrmStupDto;
import com.its.op.service.its.facility.TbFcltSttsAlrmStupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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 = "01.시설물관리-4.시설물 상태 알람 설정")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/facility/tb_fclt_stts_alrm_stup")
public class TbFcltSttsAlrmStupController {

    private final TbFcltSttsAlrmStupService service;

    @ApiOperation(value = "시설물 상태 알람 설정 전체조회(TB_FCLT_STTS_ALRM_STUP)", response = TbFcltSttsAlrmStupDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/list", produces = {"application/json; charset=utf8"})
    public List<TbFcltSttsAlrmStupDto> findAllList() {
        return this.service.findAllList();
    }

    @ApiOperation(value = "시설물 상태 알람 설정 개별조회(TB_FCLT_STTS_ALRM_STUP)", response = TbFcltSttsAlrmStupDto.class)
    @GetMapping(value = "/{fcltType}", produces = {"application/json; charset=utf8"})
    public List<TbFcltSttsAlrmStupDto> findListById(
            @ApiParam(name = "fcltType", value = "VMS/VDS/CCTV/DSRC/WCAM 선택", example = "VMS", required = true)
            @PathVariable("fcltType") final String fcltType) {
        return this.service.findListById(fcltType);
    }

    @ApiOperation(value = "시설물 상태 알람 설정 정보변경/생성-목록(TB_FCLT_STTS_ALRM_STUP)", response = TbFcltSttsAlrmStupDto.class, responseContainer = "ArrayList")
    @PostMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbFcltSttsAlrmStupDto> mergeInfoList(@RequestBody @Valid final List<TbFcltSttsAlrmStupDto.TbFcltSttsAlrmStupUpdReq> listReq) {
        return this.service.mergeInfoList(listReq);
    }

}
