package com.tashow.cloud.payapi.api.refund;

import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.payapi.api.refund.dto.PayRefundCreateReqDTO;
import com.tashow.cloud.payapi.api.refund.dto.PayRefundRespDTO;
import com.tashow.cloud.payapi.enums.ApiConstants;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
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;

/**
 * RPC 服务 - 退款单
 */
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿：fallbackFactory =
public interface PayRefundApi {

    String PREFIX = ApiConstants.PREFIX + "/refund";

    /**
     * 创建退款单
     * @param reqDTO
     * @return
     */
    @PostMapping(PREFIX + "/create")
    CommonResult<Long> createRefund(@Valid @RequestBody PayRefundCreateReqDTO reqDTO);

    /**
     * 获得退款单
     * @param id 退款单编号
     * @return
     */
    @GetMapping(PREFIX + "/get")
    CommonResult<PayRefundRespDTO> getRefund(@RequestParam("id") Long id);

}
