package cn.stylefeng.workflow.instance.api.pojo.task;

import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.annotation.EnumFieldFormat;
import cn.stylefeng.roses.kernel.rule.annotation.SimpleFieldFormat;
import cn.stylefeng.roses.kernel.rule.enums.FormatTypeEnum;
import cn.stylefeng.roses.kernel.sys.api.format.OrgNameFormatProcess;
import cn.stylefeng.roses.kernel.sys.api.format.PositionNameFormatProcess;
import cn.stylefeng.roses.kernel.sys.api.format.UserAvatarFormatProcess;
import cn.stylefeng.workflow.api.entity.instance.RuntimeNode;
import cn.stylefeng.workflow.api.enums.InstanceStatusEnum;
import cn.stylefeng.workflow.api.enums.TaskStatusEnum;
import cn.stylefeng.workflow.api.format.DefinitionDetailFormatProcess;
import cn.stylefeng.workflow.api.pojo.instance.SummaryFieldValue;
import cn.stylefeng.workflow.instance.api.pojo.tag.SimpleRemarkVo;
import cn.stylefeng.workflow.instance.api.pojo.tag.SimpleTagVo;
import lombok.Data;

import java.util.Date;
import java.util.List;
import java.util.Set;

@Data
public class CommonTaskItem {

    @ChineseDescription("业务主键id，一般为任务id或者草稿id")
    private Long id;

    @ChineseDescription("流程实例id")
    private Long instanceId;

    @ChineseDescription("所属流程定义id")
    @SimpleFieldFormat(processClass = DefinitionDetailFormatProcess.class)
    private Long definitionId;

    @ChineseDescription("流程的标题，一般为流程实例标题或者草稿的标题")
    private String instanceTitle;

    @ChineseDescription("发起人id")
    @SimpleFieldFormat(processClass = UserAvatarFormatProcess.class)
    private Long applicant;

    @ChineseDescription("发起人的组织机构id，以哪个身份发起")
    @SimpleFieldFormat(processClass = OrgNameFormatProcess.class)
    private Long applicantOrgId;

    @ChineseDescription("发起人的职位id，以哪个身份发起")
    @SimpleFieldFormat(processClass = PositionNameFormatProcess.class)
    private Long applicantPositionId;

    @ChineseDescription("流程或者草稿的创建时间")
    private Date createTime;

    @ChineseDescription("时长")
    private String durationFormat;

    @ChineseDescription("当前进行中的节点")
    private List<RuntimeNode> currentRuntimeNodeList;

    @ChineseDescription("当前进行中的审批人，存放用户id集合")
    @SimpleFieldFormat(formatType = FormatTypeEnum.ADD_FIELD, processClass = UserAvatarFormatProcess.class)
    private Set<Long> currentApproverList;

    @ChineseDescription("流程实例状态：10-草稿，20-处理中，30-已完成，40-拒绝，50-挂起，60-作废")
    @EnumFieldFormat(processEnum = InstanceStatusEnum.class)
    private Integer instanceStatus;

    @ChineseDescription("任务状态：10-发起，15-待开始，20-审批中，30-已审批，40-已拒绝，50-已退回，60-已撤回，70-已关闭，80-已转交")
    @EnumFieldFormat(processEnum = TaskStatusEnum.class)
    private Integer taskStatus;

    @ChineseDescription("摘要字段列表")
    private List<SummaryFieldValue> summaryFieldValueList;

    @ChineseDescription("流程标签列表")
    private List<SimpleTagVo> tagList;

    @ChineseDescription("流程备注列表")
    private List<SimpleRemarkVo> remarkList;

    @ChineseDescription("流程完成时间")
    private Date completionTime;

}
