package cn.axzo.msg.center.service.pending.card;

import cn.axzo.msg.center.service.pending.request.CardPresetButtonPressedRequest;
import cn.axzo.msg.center.service.pending.request.CardSendRequest;
import cn.axzo.msg.center.service.pending.request.CardUpdateStateRequest;
import cn.axzo.msg.center.service.pending.response.CardSendResponse;
import cn.azxo.framework.common.model.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;

/**
 * @author yanglin
 */
@Component
@FeignClient(value = "msg-center", url = "${server.serviceUrl:http://msg-center:8080}")
public interface CardClient {

    @PostMapping(value = "/api/card/send",
            produces = {MediaType.APPLICATION_JSON_VALUE})
    CommonResponse<CardSendResponse> send(
            @RequestBody @Valid CardSendRequest request);

    @PostMapping(value = "/api/card/updateState",
            produces = {MediaType.APPLICATION_JSON_VALUE})
    CommonResponse<Void> updateState(
            @RequestBody @Valid CardUpdateStateRequest request);

    @PostMapping(value = "/api/card/firePresetButtonPressed",
            produces = {MediaType.APPLICATION_JSON_VALUE})
    CommonResponse<Void> firePresetButtonPressed(
            @RequestBody @Valid CardPresetButtonPressedRequest request);

}