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

import com.ywt.mg.core.utils.Checker;

public enum RelationshipEnum {

    Myself("本人", 1),
    Family("家庭成员", 2),
    Friend("朋友", 3),
    Other("其他",4),
    Baby("婴儿", 5);


    private final String displayName;

    private final int value;

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

    public String getDisplayName() {
        return displayName;
    }

    public int getValue() {
        return value;
    }

    public static RelationshipEnum valueOf(int value) {
        for (RelationshipEnum enumObj : RelationshipEnum.values()) {
            if (enumObj.getValue() == value) {
                return enumObj;
            }
        }
        return null;
    }
    public static String getDisplayName(int value) {
        RelationshipEnum enumObj = valueOf(value);
        if (!Checker.isNone(enumObj)){
            return enumObj.displayName;
        }
        return "";
    }
}
