package com.xisc.pm.infra.feign;

import com.xisc.pm.domain.vo.EventFeignVO;
import com.xisc.pm.infra.feign.fallback.CtEventFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * fileName: CtEventFeign
 * description:
 * history:
 *
 * @author 张建元 jianyuan.zhang@hand-china.com
 * @version 1.0.0
 * @since 2024-07-26 08:22
 */
@FeignClient(value = "${xisc.service.ct.name:xisc-ct}", fallbackFactory = CtEventFeignFallbackFactory.class)
public interface CtEventFeign {
    /**
     * 事件API接口
     *
     * @param tenantId     租户ID
     * @param eventRequest 事件请求内容
     * @return 处理结果，如果成功则不返回任何结果，如果失败返回对应的报错消息
     */
    @PostMapping({"/v1/{organizationId}/event-api"})
    ResponseEntity<String> eventExecute(@PathVariable("organizationId") Long tenantId,
                                        @RequestBody EventFeignVO eventRequest);

    /**
     * 事件API接口
     *
     * @param tenantId     租户ID
     * @param eventRequest 事件请求内容
     * @return 处理结果，如果成功则不返回任何结果，如果失败返回对应的报错消息
     */
    @PostMapping({"/v1/{organizationId}/batch-event-api"})
    ResponseEntity<String> eventExecute(@PathVariable("organizationId") Long tenantId,
                                        @RequestBody List<EventFeignVO> eventRequest);

    /**
     * 获取合同日期
     *
     * @param organizationId
     * @param orderNoList
     * @return
     */
    @PostMapping({"/v1/{organizationId}/plan/delivery/completed/api"})
    ResponseEntity<String> planDeliveryCompletedApi(@PathVariable Long organizationId,
                                                                            @RequestBody List<String> orderNoList);
}