package cn.axzo.msg.center.service.bizevent.client;

import cn.axzo.msg.center.service.bizevent.client.fallback.BizEventMappingClientFallback;
import cn.axzo.msg.center.service.bizevent.request.BizEventMappingCreateRequest;
import cn.axzo.msg.center.service.bizevent.request.BizEventMappingPageRequest;
import cn.axzo.msg.center.service.bizevent.request.BizEventMappingPageResponse;
import cn.axzo.msg.center.service.bizevent.request.BizEventMappingRemoveRequest;
import cn.axzo.msg.center.service.bizevent.request.BizEventMappingUpdateRequest;
import cn.azxo.framework.common.model.CommonResponse;
import cn.azxo.framework.common.model.Page;
import javax.validation.Valid;
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;

/**
 * 业务事件管理
 *
 */
@Component
@FeignClient(value = "msg-center", url = "${server.serviceUrl:http://msg-center:8080}",
        fallback = BizEventMappingClientFallback.class)
public interface BizEventMappingClient {

    /**
     * 添加业务事件映射
     */
    @PostMapping(value = "/biz-event/add", produces = {MediaType.APPLICATION_JSON_VALUE})
    CommonResponse<String> save(@RequestBody @Valid BizEventMappingCreateRequest param);

    /**
     * 编辑业务事件映射
     */
    @PostMapping(value = "/biz-event/update", produces = {MediaType.APPLICATION_JSON_VALUE})
    CommonResponse<Void> update(@RequestBody @Valid BizEventMappingUpdateRequest param);

    /**
     * 分页查询业务事件映射
     *
     * @param param 分页查询参数
     */
    @PostMapping(value = "/biz-event/page", produces = {MediaType.APPLICATION_JSON_VALUE})
    CommonResponse<Page<BizEventMappingPageResponse>> page(@RequestBody BizEventMappingPageRequest param);

    /**
     * 移除业务事件
     */
    @PostMapping(value = "/biz-event/remove", produces = {MediaType.APPLICATION_JSON_VALUE})
    CommonResponse<Void> remove(@RequestBody @Valid BizEventMappingRemoveRequest param);
}
