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

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yuchen.saas.park.api.entity.fault.ConnectEvent;
import com.yuchen.saas.park.api.entity.park.PmgBatDeviceData;
import com.yuchen.saas.park.api.vo.fault.DeviceProperty;
import com.yuchen.saas.park.service.pull.input.DeviceConnectInput;
import com.yuchen.saas.park.service.pull.input.DeviceEventInput;
import com.yuchen.saas.park.service.pull.input.DevicePropertyInput;
import com.yuchen.saas.park.service.service.ParkDeviceDataService;
import com.yuchen.saas.parking.api.vo.IoTEvent;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.nest.springwrap.core.mp.support.Condition;
import org.nest.springwrap.core.mp.support.Query;
import org.nest.springwrap.core.tool.api.R;
import org.nest.springwrap.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

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

@RestController
@AllArgsConstructor
@RequestMapping("/device/input")
@Api(value = "IOT设备输入", tags = "IOT设备输入")
public class DeviceInputController {


    @Autowired
    private DeviceConnectInput deviceConnectInput;
    @Autowired
    private DeviceEventInput deviceEventInput;
    @Autowired
    private DevicePropertyInput devicePropertyInput;

    @PostMapping("/deviceConnectInput")
    @ApiOperationSupport(order = 1)
    public R deviceConnectInput(@RequestBody ConnectEvent connectEvent) {
        deviceConnectInput.inputData(connectEvent);
        return R.success();
    }
    @PostMapping("/deviceEventInput")
    @ApiOperationSupport(order = 1)
    public R deviceEventInput(@RequestBody IoTEvent ioTEvent) {
        deviceEventInput.inputData(ioTEvent);
        return R.success();
    }
    @PostMapping("/devicePropertyInput")
    @ApiOperationSupport(order = 1)
    public R devicePropertyInput(@RequestBody DeviceProperty deviceProperty) {
        devicePropertyInput.inputData(deviceProperty);
        return R.success();
    }


}
