package com.erp.order.client;

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

@FeignClient(name = "platform-sync-service", url = "${platform.sync.url:http://platform-sync-service}")
public interface PlatformSyncClient {

    /**
     * 同步订单状态到平台
     */
    @PostMapping("/api/platform/sync/order")
    ApiResponse<?> syncOrderToPlatform(@RequestBody PlatformSyncRequest request);

    /**
     * 从平台拉取订单
     */
    @GetMapping("/api/platform/pull/orders")
    ApiResponse<?> pullOrdersFromPlatform(@RequestParam String platform,
                                          @RequestParam Long shopId,
                                          @RequestParam String pullType,
                                          @RequestParam(required = false) String orderIds,
                                          @RequestParam(required = false) String startTime,
                                          @RequestParam(required = false) String endTime);

    class PlatformSyncRequest {
        private String platform;
        private String platformOrderSn;
        private String syncStatus;
        private String expressCompany;
        private String expressNo;

        public String getPlatform() { return platform; }
        public void setPlatform(String platform) { this.platform = platform; }
        public String getPlatformOrderSn() { return platformOrderSn; }
        public void setPlatformOrderSn(String platformOrderSn) { this.platformOrderSn = platformOrderSn; }
        public String getSyncStatus() { return syncStatus; }
        public void setSyncStatus(String syncStatus) { this.syncStatus = syncStatus; }
        public String getExpressCompany() { return expressCompany; }
        public void setExpressCompany(String expressCompany) { this.expressCompany = expressCompany; }
        public String getExpressNo() { return expressNo; }
        public void setExpressNo(String expressNo) { this.expressNo = expressNo; }
    }
}
