package com.yuchen.saas.device.api.feign;

import com.thinkunion.park.service.common.iot.capability.devicemodel.DeviceModel;
import com.thinkunion.sdk.iot.bean.api.CallingDeviceServiceResponse;
import com.thinkunion.sdk.iot.bean.api.SettingDevicePropertyResponse;
import com.thinkunion.sdk.iot.bean.pojo.DeviceInfo;
import com.thinkunion.sdk.iot.bean.pojo.ProductInfo;
import com.yuchen.saas.device.api.dto.CallDeviceServiceDto;
import com.yuchen.saas.device.api.dto.SetIotDevicePropertyDto;
import com.yuchen.saas.device.api.dto.operatingEnd.NetDeviceModelAbilityQryReqDTO;
import com.yuchen.saas.device.api.entity.NetDeviceWalk;
import com.yuchen.saas.device.api.vo.ProductKeyVo;
import com.yuchen.saas.device.api.vo.operatingEnd.NetDeviceModelAbilityVO;
import org.nest.springwrap.core.launch.app.AppNameConstant;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
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 java.util.List;


@FeignClient(
        value = AppNameConstant.SAAS_DEVICE,
        fallback = IotFeignServiceFallback.class
)
public interface IotFeignService {

    /**
     * 获取iot所有产品信息
     */
    @GetMapping("/netIot/findAllProduct")
    R<List<ProductInfo>> findAllProduct();

    /**
     * 获取iot所有产品key和产品名称
     */
    @GetMapping("/netIot/findAllProductKey")
    R<List<ProductKeyVo>> findAllProductKey();

    /**
     * 根据产品获取IOT设备
     */
    @GetMapping("/findDeviceListIot")
    R<List<DeviceInfo>> findDeviceListIot(@RequestParam("productKey")String productKey);

    /**
     * 获取产品物模型
     */
    @GetMapping("/getDeviceModel")
    R<DeviceModel> getDeviceModel(@RequestParam("productKey")String productKey);

    /**
     * 设置iot设备属性值
     */
    @PostMapping("/setProperty")
    R<SettingDevicePropertyResponse> setProperty(@RequestBody SetIotDevicePropertyDto dto);

    /**
     * 调用 iot 设备服务
     */
    @PostMapping("/callDeviceService")
    R<CallingDeviceServiceResponse> callDeviceService(@RequestBody CallDeviceServiceDto dto);

    /**
     * 调用 iot 设备服务
     */
    @GetMapping("/netDeviceWalk/getByDeviceName")
    R<NetDeviceWalk> getByDeviceName(@RequestParam("deviceName")String deviceName);

    /**
     * 获取设备物模型能力
     */
    @PostMapping("/netOperateDevice/getDeviceModelAbilityDetail")
    R<List<NetDeviceModelAbilityVO>> getByDeviceName(@RequestBody NetDeviceModelAbilityQryReqDTO qryDto);


}
