package com.liquidnet.service.feign.stone.api;

import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.stone.dto.StoneScoreListDto;
import feign.hystrix.FallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;

/**
 * <p>
 * 积分接口
 * </p>
 *
 * @author jiangxiulong
 * @since 2021-11-02
 */
@Component
@FeignClient(
        name = "liquidnet-service-stone",
        contextId = "FeignStoneIntegralClient",
        path = "",
        url = "${liquidnet.service.stone.url}",
        fallback = FallbackFactory.Default.class
)
public interface FeignStoneIntegralClient {

    // 用户积分数据
    @GetMapping(value = "user/info", headers = {"Inner-Required=1"})
    ResponseDto<StoneScoreListDto> stoneUserInfo();

    // 增加积分 积分有上线
    @PostMapping(value = "user/logs/in2111")
    ResponseDto<String> in2111(
            @RequestParam(value = "uid") String uid,
            @RequestParam(value = "score") Integer score,
            @RequestParam(value = "content") String content
    );

    // 增加积分 积分无上线
    @PostMapping(value = "user/logs/in2112")
    ResponseDto<String> in2112(
            @RequestParam(value = "uid") String uid,
            @RequestParam(value = "score") Integer score,
            @RequestParam(value = "content") String content
    );

    // 减少积分
    @PostMapping(value = "user/logs/de2111")
    ResponseDto<String> de2111(
            @RequestParam(value = "uid") String uid,
            @RequestParam(value = "score") Integer score,
            @RequestParam(value = "content") String content
    );

    // 做积分任务
    @PostMapping(value = "user/inner/doTask")
    ResponseDto<HashMap<String, Object>> doTask(
            @RequestParam(value = "taskId") Integer taskId,
            @RequestParam(value = "uid") String uid
    );

}
