package cn.iocoder.yudao.module.hrm.api.crmbusiness;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.hrm.api.crmbusiness.dto.CrmBusinessDTO;
import cn.iocoder.yudao.module.hrm.api.crmbusiness.dto.CrmBusinessProductDTO;
import cn.iocoder.yudao.module.hrm.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = ApiConstants.NAME) // TODO 芋艿：fallbackFactory =
@Tag(name = "RPC 服务 - 流程实例")
public interface BusinessApi {

    String PREFIX = ApiConstants.PREFIX + "/crm/business";

    @GetMapping(PREFIX + "/get")
    @Operation(summary = "获得商机信息")
    @Parameter(name = "id", description = "ID", required = true)
    CommonResult<CrmBusinessDTO> getBusiness(@RequestParam("id") Long id);

    @GetMapping(PREFIX + "/getByBusinessId")
    @Operation(summary = "获得商机所绑定产品信息")
    @Parameter(name = "businessId", description = "商机编号", required = true)
    CommonResult<List<CrmBusinessProductDTO>> getBusinessProduct(@RequestParam("businessId") Long businessId);

    @GetMapping(PREFIX + "/updateIsEnd")
    @Operation(summary = "更新商机状态")
    @Parameter(name = "id", description = "ID", required = true)
    CommonResult<Boolean> updateIsEnd(@RequestParam("id") Long id, @RequestParam("isEnd") Integer isEnd);
}
