package com.seer.teach.mall.api;

import com.seer.teach.mall.api.req.OrderPayNotifyReq;
import com.seer.teach.mall.api.req.OrderRefundNotifyReq;
import com.seer.teach.mall.api.resp.OrderDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 商城订单API接口
 */
@FeignClient(name = ApiConstants.SERVER_NAME, contextId = "mallOrderApi", path = "/seer/mall")
public interface MallOrderApi {
    /**
     * 获取订单信息
     *
     * @param orderId 订单ID
     * @return 订单信息
     */
    @GetMapping("/internal/order/{orderId}")
    OrderDTO getOrder(@PathVariable("orderId") Integer orderId);

    /**
     * 获取订单信息
     *
     * @param orderSn 订单编号
     * @return 订单信息
     */
    @GetMapping("/internal/order/orderSn/{orderSn}")
    OrderDTO getOrderByOrderSn(@PathVariable("orderSn") String orderSn);

    /**
     * 订单支付成功的回调
     *
     * @param orderPayNotifyReq 订单支付通知请求
     * @return 处理结果
     */
    @PostMapping("/internal/order/pay/success")
    boolean orderPayAfterSuccessNotify(@RequestBody OrderPayNotifyReq orderPayNotifyReq);

    /**
     * 订单支付失败通知
     *
     * @param orderPayNotifyReq 订单支付通知请求
     * @return 处理结果
     */
    @PostMapping("/internal/order/pay/fail")
    boolean orderPayAfterFailNotify(@RequestBody OrderPayNotifyReq orderPayNotifyReq);

    /**
     * 取消订单退款成功通知
     *
     * @param orderRefundNotifyReq 订单退款通知请求
     * @return 处理结果
     */
    @PostMapping("/internal/order/cancel/refund/notify/success")
    boolean cancelOrderRefundAfterSuccessNotify(@RequestBody OrderRefundNotifyReq orderRefundNotifyReq);

    /**
     * 取消订单退款失败通知
     *
     * @param orderRefundNotifyReq 订单退款通知请求
     * @return 处理结果
     */
    @PostMapping("/internal/order/cancel/refund/notify/fail")
    boolean cancelOrderRefundAfterFailNotify(@RequestBody OrderRefundNotifyReq orderRefundNotifyReq);
}