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

import cn.axzo.msg.center.service.card.request.CardStyleCreateRequest;
import cn.axzo.msg.center.service.card.request.CardStyleDeleteRequest;
import cn.axzo.msg.center.service.card.request.CardStylePageRequest;
import cn.axzo.msg.center.service.card.request.CardStyleUpdateRequest;
import cn.axzo.msg.center.service.card.response.CardStyleDetailResponse;
import cn.axzo.msg.center.service.card.response.CardStylePageResponse;
import cn.azxo.framework.common.model.CommonResponse;
import cn.azxo.framework.common.model.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;

/**
 * 卡片样式
 */
@Component
@FeignClient(value = "msg-center", url = "${server.serviceUrl:http://msg-center:8080}")
public interface CardStyleClient {


    /**
     * 添加卡片样式
     *
     * @param request 卡片样式数据模型
     * @return 编码
     */
    @PostMapping(value = "/card/style/add", produces = {MediaType.APPLICATION_JSON_VALUE})
    CommonResponse<String> save(@RequestBody @Valid CardStyleCreateRequest request);

    /**
     * 编辑卡片样式
     *
     * @param request 卡片样式数据模型
     */
    @PostMapping(value = "/card/style/update", produces = {MediaType.APPLICATION_JSON_VALUE})
    CommonResponse<Void> update(@RequestBody @Valid CardStyleUpdateRequest request);

    /**
     * 删除卡片样式
     */
    @PostMapping(value = "/card/style/delete", produces = {MediaType.APPLICATION_JSON_VALUE})
    CommonResponse<Void> delete(@RequestBody @Valid CardStyleDeleteRequest request);

    /**
     * 卡片样式详情
     *
     * @param code 卡片样式编码
     * @return 卡片样式详情
     */
    @GetMapping(value = "/card/style/detail", produces = {MediaType.APPLICATION_JSON_VALUE})
    CommonResponse<CardStyleDetailResponse> detail(@RequestParam("code") String code);

    /**
     * 分页查询模板
     *
     * @param request 分页查询参数
     * @return 模板列表
     */
    @PostMapping(value = "/card/style/page", produces = {MediaType.APPLICATION_JSON_VALUE})
    CommonResponse<Page<CardStylePageResponse>> page(@RequestBody @Valid CardStylePageRequest request);


}
