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;

/**
 * Bpm 业务表单的类型
 *
 * @author jinyd
 */
@AllArgsConstructor
@Getter
public enum BpmBusinessTypeEnum implements ArrayValuable<Integer> {

    APPLY_ACCOMMODATION(1, "apply_accommodation"), //申请入住
    APPLY_RETREAT(2, "apply_retreat"), //申请退住
    OUTBOUND_REGISTRATION(3, "outbound_registration"), //外出登记
    BED_CHANGE(4, "bed_change"), //床位变更
    NURSE_CHANGE(5, "nurse_change"), //护理变更
    CATERING_CHANGE(6, "catering_change"), //餐饮变更
    PRICE_CHANGE(7, "price_change"), //价格变更
    TRANSFER_CHANGE(8, "transfer_change"), //转院变更
    CHECK_IN(9, "check_in"), //办理入住
    CHECK_IN_WAIT(10, "check_in_wait"); //轮候入住

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

    /**
     * 类型
     */
    private final Integer value;
    /**
     * 转改名
     */
    private final String key;

    public static BpmBusinessTypeEnum valueOf(Integer value) {
        return ArrayUtil.firstMatch(businessType -> businessType.getValue().equals(value), BpmBusinessTypeEnum.values());
    }

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

}
