package cn.axzo.workflow.common.model.request.bpmn.task;

import cn.axzo.workflow.common.constraint.AttachmentTypeValidator;
import cn.axzo.workflow.common.constraint.AttachmentValidator;
import cn.axzo.workflow.common.enums.AttachmentTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * 完成机器人节点的入参模型
 *
 * @author wangli
 * @since 2023/12/18 15:26
 */
@ApiModel("完成机器人节点的入参模型")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class BpmnRobotTaskCompleteDTO {

    /**
     * 流程实例 ID
     */
    @ApiModelProperty(value = "流程实例 ID")
    @NotBlank(message = "流程实例 ID 不能为空")
    private String processInstanceId;

    /**
     * 任务 ID
     */
    @ApiModelProperty(value = "流程任务 ID")
    @NotBlank(message = "审批任务 ID 不能为空")
    private String taskId;

    /**
     * 完成机器人节点的人信息
     *
     * @since 暂不支持传人员信息
     */
    @ApiModelProperty(value = "当前审核人信息", notes = "可为空,则该任务不验证用户归属")
    @Deprecated
    private BpmnTaskDelegateAssigner approver;

    @ApiModelProperty(value = "机器人节点信息")
    @Valid
    private BpmnFlowNodeDTO robotNode;

    /**
     * 图片附件
     */
    @ApiModelProperty(value = "附件列表")
    @Size(max = 11, message = "附件数量超过限制")
    @AttachmentValidator(types = {
            @AttachmentTypeValidator(type = AttachmentTypeEnum.image, max = 5),
            @AttachmentTypeValidator(type = AttachmentTypeEnum.file, max = 5),
            @AttachmentTypeValidator(type = AttachmentTypeEnum.signature, max = 1)}
    )
    private List<AttachmentDTO> attachmentList;

    /**
     * 是否异步执行
     */
    @ApiModelProperty(value = "是否异步", notes = "异步时,只接收请求便返回数据")
    @Builder.Default
    private Boolean async = false;
}
