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.CsLedgerFeignClientFallbackFactory;
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
import com.njcn.csdevice.pojo.dto.LineParamDTO;
import com.njcn.csdevice.pojo.param.CsLedgerParam;
import com.njcn.csdevice.pojo.po.CsLedger;
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
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 = "/csLedger", fallbackFactory = CsLedgerFeignClientFallbackFactory.class,contextId = "csLedger")
public interface CsLedgerFeignClient {

    @PostMapping("/findDevByLineId")
    HttpResult<String> findDevByLineId(@RequestParam("lineId") String lineId);

    @PostMapping("/add")
    HttpResult<CsLedger> add(@RequestBody @Validated CsLedgerParam csLedgerParam);

    @PostMapping("/queryLine")
    HttpResult<List<CsLedger>> queryLine(@RequestBody @Validated LineParamDTO lineParamdto);

    @PostMapping("/queryDevDetail")
    HttpResult<DevDetailDTO> queryDevDetail(@RequestParam("devId")  String devId);

    @PostMapping("/lineTree")
    @ApiOperation("五层设备树(监测点层,根节点为治理设备和便携式设备)")
    HttpResult<List<CsLedgerVO>> lineTree();

    @PostMapping("/deviceTree")
    @ApiOperation("三层设备树(装置层)")
    HttpResult<List<CsLedgerVO>> getDeviceTree();

    @PostMapping("/getAllLedger")
    HttpResult<List<CsLedgerVO>> getAllLedger();

    @PostMapping("/getInfoByIds")
    HttpResult<List<DevDetailDTO>> getInfoByIds(@RequestBody @Validated List<String> list);

    @PostMapping("/getDevInfoByEngineerIds")
    @ApiOperation("根据工程获取设备信息")
    HttpResult<List<DevDetailDTO>> getDevInfoByEngineerIds(@RequestBody @Validated List<String> list);

    @PostMapping("/getEngineeringHaveDevs")
    @ApiOperation("根据工程信息获取有设备的工程")
    HttpResult<List<DevDetailDTO>> getEngineeringHaveDevs(@RequestBody @Validated List<String> list);

}
