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

import com.neusoft.smart.pos.dto.ota.request.UpgradeHistoryQueryRequest;
import com.neusoft.smart.pos.dto.ota.request.UpgradeHistoryRequest;
import com.neusoft.smart.pos.dto.ota.request.UpgradePackageQueryRequest;
import com.neusoft.smart.pos.dto.ota.response.ApkStrategyResponse;
import com.neusoft.smart.pos.dto.ota.response.AppInfoResponse;
import com.neusoft.smart.pos.dto.ota.response.UpgradeHistoryExtResponse;
import com.neusoft.smart.pos.dto.ota.response.UpgradeHistoryResponse;
import com.neusoft.smart.pos.dto.ota.response.UpgradePackageResponse;
import com.neusoft.smart.pos.dto.ota.response.UpgradeStrategyResponse;
import com.neusoft.smart.pos.framework.bean.PaginationExtendBean;
import com.neusoft.smart.pos.framework.dto.ResponseData;
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 org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "service-ota")
public interface RemoteOTAService {
	
	@PostMapping("/upgradeHistories")
	ResponseData<PaginationExtendBean<UpgradeHistoryResponse>> historyList(UpgradeHistoryQueryRequest upgradeHistoryQueryRequest);
	
	@GetMapping("/upgradeStrategy/relation/{groupId}")
	ResponseData<List<UpgradeStrategyResponse>> strategyList(@PathVariable("groupId") Integer groupId);
	
	@GetMapping("/upgradePackage/{packageId}")
	ResponseData<UpgradePackageResponse> getPackage(@PathVariable("packageId") Integer packageId);
	
	@PostMapping("/upgradePackages")
	ResponseData<PaginationExtendBean<UpgradePackageResponse>> list(@RequestBody UpgradePackageQueryRequest upgradePackageQueryRequest);
	
	@PostMapping("/upgradeHistory")
	ResponseData<UpgradeHistoryResponse> create(@RequestBody UpgradeHistoryRequest upgradeHistoryRequest);
	
	@PutMapping("/upgradeStrategy/updateStatus")
	ResponseData<?> updateStatus(@RequestBody List<Pair<Integer, Integer>> ids);
	
	@GetMapping("/strategy/load2Redis")
	String load2Redis();
	
	@GetMapping("/upgradeHistories/lastUpdateTime")
	ResponseData<List<UpgradeHistoryExtResponse>> getLastUpdateTime(@RequestParam("deviceIds") List<Integer> deviceIds);
	
	@GetMapping("/apkVersionStrategy/app/{groupId}")
	ResponseData<List<AppInfoResponse>> getApps(@PathVariable("groupId") Integer groupId);
	
	@GetMapping("/apkVersionStrategy/strategies/{groupId}")
	ResponseData<List<ApkStrategyResponse>> getApkVersionStrategy(@PathVariable("groupId") Integer groupId);
}
