/*
 * Copyright ©2023 CJB-CNIT Team. All rights reserved
 */
package com.openhis.common.enums.ybenums;

import com.core.common.utils.StringUtils;
import com.openhis.common.enums.HisEnumInterface;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 账户类型
 *
 * @author zwh
 * @date 2025-03-14
 */
@Getter
@AllArgsConstructor
public enum PriorityType implements HisEnumInterface {

    /**
     * 特级
     */
    SPECIAL_GRADE(1, "01", "特级"),

    /**
     * 一级
     */
    ONE_GRADE(2, "02", "一级"),

    /**
     * 二级
     */
    TWO_GRADE(3, "03", "二级"),

    /**
     * 三级
     */
    THREE_GRADE(4, "04", "三级");

    private Integer value;
    private String code;
    private String info;

    public static PriorityType getByValue(Integer value) {
        if (value == null) {
            return null;
        }
        for (PriorityType val : values()) {
            if (val.getValue().equals(value)) {
                return val;
            }
        }
        return null;
    }

    public static PriorityType getByCode(String code) {
        if (StringUtils.isEmpty(code)) {
            return null;
        }
        for (PriorityType val : values()) {
            if (val.getCode().equals(code)) {
                return val;
            }
        }
        return null;
    }
}
