package com.sptg.device.api.feigns;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.device.api.dto.DeviceOptionsDto;
import com.sptg.device.api.entity.DeviceOptions;
import com.sptg.device.api.feigns.fallback.DeviceOptionsFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


@FeignClient(value = "smart-house-device",fallbackFactory = DeviceOptionsFeignFallbackFactory.class)
public interface DeviceOptionsFeign {

    /**
     * 添加设备配置
     * @param deviceOptionsDto 设备配置
     * @return ResultBean<Boolean>
     */
    @PostMapping(value = "/device/options/add")
    Boolean add(@RequestBody DeviceOptionsDto deviceOptionsDto);

    /**
     * 修改设备配置
     * @param deviceOptionsDto 设备配置
     * @return ResultBean<Boolean>
     */
    @PostMapping(value = "/device/options/edit")
    Boolean edit(@RequestBody DeviceOptionsDto deviceOptionsDto);

    /**
     * 删除设备配置
     * @param deviceOptionsDto 设备配置
     * @return ResultBean<Boolean>
     */
    @PostMapping(value = "/device/options/deleteOptions")
    Boolean deleteOptions(@RequestBody DeviceOptionsDto deviceOptionsDto);
    @PostMapping(value = "/device/options/deleteByOptionsId")
    Boolean deleteByOptionsId(@RequestBody Long id);

    /**
     * 根据设备序列号获取记录
     * @param serialNumber 设备序列号
     * @return DeviceOptions
     */
    @GetMapping(value = "/device/options/getBySerialNumber")
    DeviceOptions getBySerialNumber(@RequestBody String serialNumber);

    /**
     * 根据设备id获取记录
     * @param deviceId 设备id
     * @return DeviceOptions
     */
    @GetMapping(value = "/device/options/getByDeviceId/{deviceId}")
    DeviceOptions getByDeviceId(@PathVariable(value = "deviceId") Long deviceId);

    /**
     * 获取一条记录
     * @param deviceOptionsDto 设备配置
     * @return DeviceOptions
     */
    @GetMapping(value = "/device/options/getOne")
    DeviceOptions getOne(@RequestBody DeviceOptionsDto deviceOptionsDto);
}
