package com.njcn.csdevice.api;

import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.csdevice.api.fallback.CsDeviceRegistryFallbackFactory;
import com.njcn.csdevice.pojo.po.CsDeviceRegistry;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
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;

/**
 * @author xy
 */
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csDeviceRegistry", fallbackFactory = CsDeviceRegistryFallbackFactory.class,contextId = "csDeviceRegistry")
public interface CsDeviceRegistryFeignClient {

    @PostMapping("/add")
    @ApiOperation("批量新增设备注册记录")
    HttpResult<Boolean> add(@RequestBody @Validated List<CsDeviceRegistry> list);

    @PostMapping("/update")
    @ApiOperation("修改设备注册记录")
    HttpResult<Boolean> update(@RequestBody @Validated CsDeviceRegistry csDeviceRegistry);

    @PostMapping("/delete")
    @ApiOperation("删除设备注册记录")
    HttpResult<Boolean> delete(@RequestParam("id") String id);

    @PostMapping("/queryByCurrentNdid")
    @ApiOperation("根据currentNdid查询设备注册记录")
    HttpResult<List<CsDeviceRegistry>> queryByCurrentNdid(@RequestParam("currentNdid") String currentNdid);

    @PostMapping("/queryByCurrentNdidAndClDid")
    @ApiOperation("根据currentNdid和clDid查询设备注册记录")
    HttpResult<CsDeviceRegistry> queryByCurrentNdidAndClDid(@RequestParam("currentNdid") String currentNdid, @RequestParam("clDid") Integer clDid);

    @PostMapping("/updateIsAccessByCurrentNdid")
    @ApiOperation("根据currentNdid修改isAccess")
    HttpResult<Boolean> updateIsAccessByCurrentNdid(@RequestParam("currentNdid") String currentNdid, @RequestParam("isAccess") Integer isAccess);

}
