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

import com.neusoft.smart.pos.dto.member.request.CreateMemberLevelRequest;
import com.neusoft.smart.pos.dto.member.request.CreateMemberRequest;
import com.neusoft.smart.pos.dto.member.request.MemberRechargeRequest;
import com.neusoft.smart.pos.dto.member.request.MemberRefundRequest;
import com.neusoft.smart.pos.dto.member.request.MemberTransactionRequest;
import com.neusoft.smart.pos.dto.member.request.UpdateCardPointRequest;
import com.neusoft.smart.pos.dto.member.response.DetailedMemberResponse;
import com.neusoft.smart.pos.dto.member.response.MemberLevelResponse;
import com.neusoft.smart.pos.framework.dto.ResponseData;
import org.springframework.cloud.netflix.feign.FeignClient;
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.math.BigDecimal;

@FeignClient(value = "service-member")
public interface RemoteMemberService {
	
	@PostMapping("/members")
	ResponseData<DetailedMemberResponse> addMember(@RequestBody CreateMemberRequest request);
	
	@GetMapping("/members/store/num")
	ResponseData<Integer> getStoreMemberNum(
			@RequestParam(value = "org", defaultValue = "-1") Integer org,
			@RequestParam(value = "store", defaultValue = "-1") Integer store
	);
	
	@GetMapping("/members/single")
	ResponseData<DetailedMemberResponse> getMemberByCondition(
			@RequestParam(value = "mobile", defaultValue = "", required = false) String mobile,
			@RequestParam(value = "cardNum", defaultValue = "", required = false) String cardNum,
            @RequestParam(value = "cardHardwareNum", defaultValue = "", required = false) String cardHardwareNum,
			@RequestParam(value = "org", defaultValue = "-1", required = false) Integer org,
			@RequestParam(value = "store", defaultValue = "-1", required = false) Integer store);
	
	@PostMapping("/memberCapitalChange/recharge")
	ResponseData<?> recharge(@RequestBody MemberRechargeRequest memberRechargeRequest);
	
	@PostMapping("/memberCapitalChange/trade")
	ResponseData<DetailedMemberResponse> trade(@RequestBody MemberTransactionRequest memberTransactionRequest);
	
	@PostMapping("/memberCapitalChange/refund")
	ResponseData<?> refund(@RequestBody MemberRefundRequest memberRefundRequest);
	
	@PutMapping("/memberCard/card-point")
	ResponseData<Integer> updateCardPoint(@RequestBody UpdateCardPointRequest request);
	
	@PostMapping("/member-level")
	ResponseData<MemberLevelResponse> createMemberLevel(@RequestBody CreateMemberLevelRequest request);
	
	@PostMapping("/memberCapitalAmountPoint/{amount}")
	ResponseData<Integer> amount2Point(@PathVariable("amount") BigDecimal amount);
	
	@PostMapping("/member/business")
	ResponseData<?> createBusiness(@RequestParam("orgId") Integer orgId, @RequestParam("businessDict") Integer businessDict);

	@GetMapping("/members/hid/{hidCode}")
	ResponseData<DetailedMemberResponse> getDetailByHidCode(@PathVariable("hidCode") String hidCode);
}
