package com.ywt.mg.domain.models.enums;

public enum OfflineConsultationSourceEnum {
    TAIHE_WX_OFFICIAL("太和医院公众号", 8),
    SCENE_SCAN("现场扫码", 0);

    private final String displayName;
    private final int value;

    OfflineConsultationSourceEnum(String displayName, int value) {
        this.displayName = displayName;
        this.value = value;
    }

    public String getDisplayName() {
        return displayName;
    }

    public int getValue() {
        return value;
    }

    public static String getDisplayName(int value){
        OfflineConsultationSourceEnum sourceEnum = valueOf(value);
        if(sourceEnum != null){
            return sourceEnum.getDisplayName();
        }
        return SCENE_SCAN.getDisplayName();
    }

    public static OfflineConsultationSourceEnum valueOf(int value) {
        for(OfflineConsultationSourceEnum sourceEnum : OfflineConsultationSourceEnum.values()){
            if(sourceEnum.getValue() == value){
                return sourceEnum;
            }
        }
        return null;
    }
}
