package com.ningdatech.pmapi.projectlib.enumeration;

import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@Getter
@AllArgsConstructor
@NoArgsConstructor
/**
 * 环节状态枚举
 * @author CMM
 * @since 2023/02/24 11:51
 */
public enum StepStatusEnum {
    /**
     * 环节状态
     */
    NOT_START(1, "未开始"),
    ON_GOING(2, "进行中"),
    REJECTED(3,"被驳回"),
    COMPLETED(4,"已完成");

    private Integer code;
    private String desc;

    public static String getDescByCode(Integer code) {
        if (Objects.isNull(code)) {
            return StringUtils.EMPTY;
        }
        for (StepStatusEnum t : StepStatusEnum.values()) {
            if (code.equals(t.getCode())) {
                return t.desc;
            }
        }
        return StringUtils.EMPTY;
    }

    public boolean eq(String val) {
        return this.name().equals(val);
    }

    public static boolean contains (StepStatusEnum e, List<StepStatusEnum> enums){
        return enums.contains(e);
    }
}
