package cn.axzo.workflow.client.feign.bpmn;

import cn.axzo.workflow.common.model.request.bpmn.task.BpmnActivitySetAssigneeDTO;
import cn.azxo.framework.common.model.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.constraints.NotBlank;

/**
 * 流程活动的 API
 *
 * @author wangli
 * @since 2023/11/17 16:28
 */
@FeignClient(name = "workflow-engine", url = "${axzo.service.workflow-engine:http://workflow-engine:8080}")
public interface ProcessActivityApi {

    /**
     * 业务节点唤醒
     */
    @GetMapping("/api/process/activity/trigger")
    CommonResponse<Boolean> trigger(@NotBlank(message = "触发 ID 不能为空") @RequestParam String triggerId, @RequestParam Boolean async);

    /**
     * 业务节点设置审批人
     *
     * @param dto
     * @return
     */
    @PostMapping("/api/process/activity/assignee/set")
    CommonResponse<Boolean> setAssignee(@Validated @RequestBody BpmnActivitySetAssigneeDTO dto);
}
