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

import com.its.api.its.model.dto.vms.TbVmsLumSetSchDto;
import com.its.api.its.model.entity.vms.TbVmsLumSetSchKey;
import com.its.api.its.service.vms.TbVmsLumSetSchService;
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 = "12.VMS-3.스케줄관리-4.휘도설정 스케줄 관리")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/vms/schedule/lum_set_sch")
public class TbVmsLumSetSchController {

    private final TbVmsLumSetSchService service;

    @ApiOperation(value = "VMS 휘도설정 스케쥴 전체조회(TB_VMS_LUM_SET_SCH)", response = TbVmsLumSetSchDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbVmsLumSetSchDto> findAll() {
        return service.findAll();
    }

    @ApiOperation(value = "VMS 휘도설정 스케쥴 개별조회(TB_VMS_LUM_SET_SCH)", response = TbVmsLumSetSchDto.class)
    @GetMapping(value = "/{id}/{time}", produces = {"application/json; charset=utf8"})
    public TbVmsLumSetSchDto findById(
            @ApiParam(name = "id", value = "VMS 제어기 관리번호", example = "10005", required = true)
            @PathVariable final Long id,
            @ApiParam(name = "time", value = "스케줄설정시각", example = "0600", required = true)
            @PathVariable final String time) {
        TbVmsLumSetSchKey key = new TbVmsLumSetSchKey(id, time);
        return this.service.findById(key);
    }
/*
    @ApiOperation(value = "VMS 휘도설정 스케쥴 정보변경(TB_VMS_LUM_SET_SCH)", response = TbVmsLumSetSchDto.class)
    @PutMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public TbVmsLumSetSchDto updateById(@PathVariable final TbVmsLumSetSchKey id, @RequestBody @Valid final TbVmsLumSetSchDto.TbVmsLumSetSchUpdReq req) {
        return this.service.updateById(id, req);
    }*/
/*

    @ApiOperation(value = "VMS 휘도설정 스케쥴 정보변경/생성-목록(TB_VMS_LUM_SET_SCH)", response = TbVmsLumSetSchDto.class, responseContainer = "ArrayList")
    @PostMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbVmsLumSetSchDto> mergeInfoList(@RequestBody @Valid final List<TbVmsLumSetSchDto.TbVmsLumSetSchUpdReq> listReq) {
        return this.service.mergeInfoList(listReq);
    }
*/

    @ApiOperation(value = "VMS 휘도설정 스케쥴 정보변경/생성-개별(TB_VMS_LUM_SET_SCH)", response = TbVmsLumSetSchDto.class)
    @PostMapping(value = "", produces = {"application/json; charset=utf8"})
    public TbVmsLumSetSchDto mergeInfo(
            @RequestBody @Valid final TbVmsLumSetSchDto.TbVmsLumSetSchUpdReq req) {
        return this.service.mergeInfo(req);
    }

    @ApiOperation(value = "VMS 휘도설정 스케쥴 정보삭제-개별(TB_VMS_LUM_SET_SCH)", response = TbVmsLumSetSchDto.class)
    @DeleteMapping(value = "/{id}/{time}", produces = {"application/json; charset=utf8"})
    public TbVmsLumSetSchDto deleteDataById(
            @ApiParam(name = "id", value = "VMS 제어기 관리번호", example = "10005", required = true)
            @PathVariable final Long id,
            @ApiParam(name = "time", value = "스케줄설정시각", example = "0600", required = true)
            @PathVariable final String time ) {
        TbVmsLumSetSchKey key = new TbVmsLumSetSchKey(id, time);
        return this.service.deleteById(key);
    }
/*
    @ApiOperation(value = "VMS 휘도설정 스케쥴 정보삭제-목록(TB_VMS_LUM_SET_SCH)", response = TbVmsLumSetSchDto.class, responseContainer = "ArrayList")
    @DeleteMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<TbVmsLumSetSchDto> deleteDataByIds(@RequestBody @Valid final List<TbVmsLumSetSchKey> ids) {
        return this.service.deleteByIds(ids);
    }*/

}
