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.WlRecordClientFallbackFactory;
import com.njcn.csdevice.pojo.param.WlRecordParam;
import com.njcn.csdevice.pojo.po.WlRecord;
import com.njcn.csdevice.pojo.vo.RecordVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
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;

/**
 * @author xy
 */
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/wlRecord", fallbackFactory = WlRecordClientFallbackFactory.class,contextId = "wlRecord")

public interface WlRecordFeignClient {

    /**
     * 新增原始数据
     */
    @PostMapping("/addBaseData")
    HttpResult<Boolean> addBaseData(@RequestBody @Validated WlRecord wlRecord);

    /**
     * 批量新增原始数据
     */
    @PostMapping("/addBaseDataList")
    HttpResult<Boolean> addBaseDataList(@RequestBody @Validated List<WlRecord> wlRecord);

    /**
     * 按条件查询设备基础数据
     * @param param
     * @return
     */
    @PostMapping("/findDevBaseData")
    HttpResult<WlRecord> findDevBaseData(@RequestBody @Validated WlRecordParam.Record param);

    @PostMapping("/updateTestRecord")
    HttpResult<Boolean> updateTestRecord(@RequestBody @Validated WlRecordParam.UpdateRecord record);


    @PostMapping("/dayDealNoEndTimeEvent")
    void dayDealNoEndTimeEvent(@RequestParam("date") String date);

    @GetMapping("/getWlAssByWlId")
    HttpResult<List<WlRecord>> getWlAssByWlId(@RequestParam("wlId")String wlId);

    @PostMapping("/findDevBaseDataByLineId")
    HttpResult<List<RecordVo>> findDevBaseDataByLineId(@RequestBody @Validated WlRecordParam.lineRecord param);

    @GetMapping("/getTestRecordById")
    HttpResult<RecordVo.RecordItemVo> getTestRecordById(@RequestParam("testRecordId") @Validated String testRecordId);
}
