package com.zhiqiyun.open.core.enmus;


/**
 * @author jtoms
 */

public enum YN implements IBaseEnum {
    /**
     *
     */
    N(0, "否"), Y(1, "是");

    private final int value;
    private final String text;

    YN(Integer value, String text) {
        this.value = value;
        this.text = text;
    }

    public static YN enumOf(Integer value) {
        YN[] values = YN.values();
        for (YN type : values) {
            if (type.value == value) {
                return type;
            }
        }
        return null;
    }

    public boolean getBoolean() {
        return this.value == 1;
    }

    @Override
    public String getText() {
        return text;
    }

    @Override
    public Integer getValue() {
        return value;
    }

    @Override
    public String getName() {
        return this.name();
    }
}
