package com.ruoyi.approvalFlow.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @author caifc
 * @date 2021-10-22 17:19
 */
@Getter
@AllArgsConstructor
public enum AuditStateEnum {

    // 状态

    SUBMIT("O", "提交"),

    UNKNOWN("N", "未知"),

    PENDING("S", "待审"),

    REVIEW_REJECTED("B", "审核退回"),

    APPROVED("A", "审核通过"),

    ;

    private final String status;
    private final String name;

    public static AuditStateEnum fromType(String tp) {
        for (AuditStateEnum type : AuditStateEnum.values()) {
            if (Objects.equals(type.getStatus(), tp)) {
                return type;
            }
        }
        throw new IllegalArgumentException("audit status not exist");
    }


}
