package com.erp.aftersale.client;

import com.erp.common.core.model.ApiResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 订单服务Feign客户端
 */
@FeignClient(name = "order-service", url = "${order.service.url}")
public interface OrderClient {

    /**
     * 获取订单详情
     */
    @GetMapping("/api/orders/{id}")
    ApiResponse<?> getOrder(@PathVariable("id") Long id);

    /**
     * 根据订单ID获取订单商品明细
     */
    @GetMapping("/api/orders/{id}/items")
    ApiResponse<?> getOrderItems(@PathVariable("id") Long id);

    /**
     * 更新订单状态（售后联动）
     */
    @PutMapping("/api/orders/{id}/status")
    ApiResponse<?> updateOrderStatus(@PathVariable("id") Long id, @RequestBody Object request);

    /**
     * 查询可售后的订单（已发货/已完成）
     */
    @GetMapping("/api/orders")
    ApiResponse<?> listAvailableOrders(@RequestParam(value = "status", required = false) String status,
                                       @RequestParam(value = "page", defaultValue = "1") Integer page,
                                       @RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize);
}
