package org.springblade.device.feign;

import com.baomidou.mybatisplus.plugins.Page;
import io.swagger.annotations.ApiParam;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.tool.api.R;
import org.springblade.device.dto.IotDeviceDTO;
import org.springblade.device.entity.IotDevice;
import org.springblade.device.vo.IotDeviceVO;
import org.springblade.device.vo.SingleDeviceStatistics;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

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

/**
 * 智能设备 Feign
 *
 * @author lianghanqiang
 * @since 2021-04-19
 */
@FeignClient(value = "cyzh-smart-device",path = "/feign/iotdevice")
public interface IIotDeviceClient  {

	/**
	 * 详情
	 */
	@GetMapping("/detail")
    IotDeviceVO detail(@SpringQueryMap IotDevice iotDevice);

	/**
	 * 详情
	 */
	@GetMapping("/getById")
	IotDevice getById(@RequestParam Long id);

	/**
	 * 详情
	 */
	@PostMapping("/getList")
	BladePage<IotDeviceVO> getList(@RequestBody IotDeviceDTO iotDeviceDTO);

	/**
	 * 查询 智能设备
	 */
	@GetMapping("/list")
    List<IotDeviceVO> list(@SpringQueryMap IotDevice iotDevice);

	/**
	 * 查询 智能设备
	 */
	@GetMapping("/listMap")
	List<IotDeviceVO> listMap(@RequestParam Map<String,Object> iotDevice);

	/**
	 * 查询roomIds下的 智能设备
	 */
	@GetMapping("/getListByRoomIds")
	List<IotDeviceVO> getListByRoomIds(@RequestParam List<Long> roomIds);



	/**
	 * 新增 智能设备
	 */
	@PostMapping("/save")
	boolean save(@Valid @RequestBody IotDevice iotDevice);

	/**
	 * 修改 智能设备
	 */
	@PostMapping("/update")
    boolean update(@Valid @RequestBody IotDevice iotDevice);

	/**
	 * 新增或修改 智能设备
	 */
	@PostMapping("/submit")
    boolean submit(@Valid @RequestBody IotDevice iotDevice);


	/**
	 * 删除 智能设备
	 */
	@PostMapping("/remove")
    boolean remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids);

	/**
	 * 获取烟感设备（烟感+烟感物模型）
	 * @param iotDevice
	 * @return
	 */
	@GetMapping("/getSmokeDeviceList")
	List<IotDevice> getSmokeDeviceList(IotDevice iotDevice);

	/**
	 * 获取气感设备
	 * @param iotDevice
	 * @return
	 */
	@GetMapping("/getGasDeviceList")
	List<IotDevice> getGasDeviceList(IotDevice iotDevice);

	/**
	 *设备数据统计
	 * @param iotDevice
	 * @return
	 */
	@GetMapping("/getIotDeviceStaticVo")
	R<IotDeviceVO> getIotDeviceStaticVo(IotDevice iotDevice);

	/**
	 * 设备列表统计
	 */
	@GetMapping("/deviceListCount")
	R<List<SingleDeviceStatistics>> deviceListCount(IotDevice iotDevice);

	/**
	 * 根据唯一标识或者IMEI号查询设备信息
	 * @param deviceId 标识id
	 * @return 设备信息
	 */
	@GetMapping("/getDeviceByDeviceIdOrImei")
	IotDeviceVO getDeviceByDeviceIdOrImei(@RequestParam String deviceId);
}
