package com.neusoft.smart.pos.gateway.service.feignService;

import com.alibaba.fastjson.JSONObject;
import com.neusoft.smart.pos.dto.device.request.DeviceQueryRequest;
import com.neusoft.smart.pos.dto.device.request.DeviceRequest;
import com.neusoft.smart.pos.dto.device.request.DeviceStatusRequest;
import com.neusoft.smart.pos.dto.device.request.DeviceStoreRequest;
import com.neusoft.smart.pos.dto.device.response.DeviceResponse;
import com.neusoft.smart.pos.framework.bean.PaginationExtendBean;
import com.neusoft.smart.pos.framework.dto.ResponseData;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.data.util.Pair;
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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(value = "service-device")
public interface RemoteDeviceService {
	
	@PostMapping("/devices")
	ResponseData<PaginationExtendBean<DeviceResponse>> fetchList(DeviceQueryRequest deviceQueryRequest);
	
	@PutMapping("/device")
	ResponseData<?> update(@RequestBody DeviceRequest deviceRequest);
	
	@PutMapping("/device/selective")
	ResponseData<?> updateSelective(@RequestBody DeviceRequest deviceRequest);
	
	@PostMapping("/device")
	ResponseData<DeviceResponse> create(@RequestBody DeviceRequest deviceRequest);
	
	@PostMapping("/device/batch")
	ResponseData<List<DeviceResponse>> createByBatch(@RequestBody List<DeviceRequest> deviceRequestList);
	
	@PutMapping("/device/store")
	@ApiOperation(value = "设置设备归属门店接口", notes = "设置设备归属门店接口")
	ResponseData<DeviceResponse> updateStore(@RequestBody DeviceStoreRequest deviceStoreRequest);
	
	@PutMapping("/device/status")
	ResponseData<Pair<List<Integer>, List<Integer>>> updateStatus(@RequestBody DeviceStatusRequest deviceStatusRequest);
	
	@GetMapping("/device/load2Redis")
	String load2Redis();
	
	@GetMapping("/OTA/Config/query/{sn}")
	JSONObject queryConfig(@PathVariable("sn") String sn);
}

