package com.tashow.cloud.tradeapi.api.order;

import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.tradeapi.api.order.dto.TradeOrderRespDTO;
import com.tashow.cloud.tradeapi.enums.ApiConstants;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.List;

@FeignClient(name = ApiConstants.NAME)
public interface TradeOrderApi {

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

    /*获得订单列表*/
    @GetMapping(PREFIX + "/order/list")
    CommonResult<List<TradeOrderRespDTO>> getOrderList(@RequestParam("ids") Collection<Long> ids);

    /*获得订单*/
    @GetMapping(PREFIX + "/get")
    CommonResult<TradeOrderRespDTO> getOrder(@RequestParam("id") Long id);

    @PutMapping(PREFIX + "/cancel-paid")
    CommonResult<Boolean> cancelPaidOrder(@RequestParam("userId") Long userId,
                                          @RequestParam("orderId") Long orderId,
                                          @RequestParam("cancelType") Integer cancelType);

}
