package com.yuchen.saas.park.service.controller.sensor;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yuchen.saas.park.api.vo.responsevo.ResponseVo;
import com.yuchen.saas.park.service.service.LampControlService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.Map;

@RestController
@AllArgsConstructor
@RequestMapping("/light")
@Api(value = "单灯控制", tags = "单灯控制接口")
public class LampControlController {

    @Autowired
    private LampControlService lightControlService;

    /**
     * 单灯开关控制
     */
    @PostMapping("/openOrClose")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "单灯开关", notes = "单灯开关")
    public R<ResponseVo> openOrClose(@Valid @RequestBody Map<String, Object> body) {
        return R.data(lightControlService.openOrClose(body));
    }


}
