package cn.iocoder.yudao.module.bpm.enums;

import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 轮候入住业务状态
 */
@AllArgsConstructor
@Getter
public enum BpmCheckInWaitStatusEnum implements ArrayValuable<Integer> {

    SUBMITTED_WAIT_FIRST_APPROVAL(1, "已提交，待第一审批人"),
    FIRST_APPROVAL_PASSED_WAIT_SECOND_APPROVAL(2, "第一审批通过，待第二审批人"),
    SECOND_APPROVAL_PASSED_WAIT_THIRD_APPROVAL(3, "第二审批通过，待第三审批人"),
    THIRD_APPROVAL_REJECT_TO_SECOND(4, "第三审批退回第二审批人"),
    THIRD_APPROVAL_PASSED_WAIT_FOURTH_APPROVAL(5, "第三审批通过，待第四审批人"),
    FOURTH_APPROVAL_REJECT_TO_THIRD(6, "第四审批退回第三审批人"),
    FOURTH_APPROVAL_PASSED_WAIT_FIFTH_APPROVAL(7, "第四审批通过，待第五审批人"),
    FIFTH_APPROVAL_PASSED_WAIT_SIXTH_APPROVAL(8, "第五审批通过，待第六审批人"),
    SIXTH_APPROVAL_PASSED_WAIT_BED_FILL(9, "第六审批通过待补床位"),
    APPROVED_FINISHED(10, "流程审批完成"),
    FIRST_APPROVAL_REJECT_TO_FAMILY(11, "第一审批驳回退家属"),
    SECOND_APPROVAL_REJECT_FINISHED(12, "第二审批驳回结束"),
    FIFTH_APPROVAL_REJECT_FINISHED(13, "第五审批驳回结束"),
    SIXTH_APPROVAL_REJECT_TO_FIFTH(14, "第六审批驳回退第五审批人");

    public static final Integer[] ARRAYS = Arrays.stream(values()).map(BpmCheckInWaitStatusEnum::getStatus).toArray(Integer[]::new);

    private final Integer status;

    private final String desc;

    public static BpmCheckInWaitStatusEnum valueOfStatus(Integer status) {
        return ArrayUtil.firstMatch(item -> item.getStatus().equals(status), BpmCheckInWaitStatusEnum.values());
    }

    @Override
    public Integer[] array() {
        return ARRAYS;
    }
}
