package com.ningdatech.pmapi.sys.model.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.concurrent.TimeUnit;

/**
 * <p>
 * ProcessDetailStatVO
 * </p>
 *
 * @author WendyYang
 * @since 2023/7/31
 **/
@Data
public class ProcessDetailStatVO {

    private Integer instType;

    private String instTypeName;

    @ApiModelProperty("流程实例总数")
    private Integer totalInst;

    @ApiModelProperty("已完成流程实例数")
    private Integer finishedInst;

    @ApiModelProperty("已完成流程实例数")
    private Integer pendingInst;

    @ApiModelProperty("平均耗时")
    private double avgTime;

    @ApiModelProperty("最长耗时")
    private double maxTime;

    @ApiModelProperty("最短耗时")
    private double minTime;

    @ApiModelProperty("时间单位")
    private TimeUnit timeUnit;

    public static ProcessDetailStatVO init() {
        ProcessDetailStatVO stat = new ProcessDetailStatVO();
        stat.setFinishedInst(0);
        stat.setTotalInst(0);
        stat.setPendingInst(0);
        return stat;
    }

    public void incrPending() {
        this.pendingInst += 1;
    }

    public void incrFinished() {
        this.finishedInst += 1;
    }

}
