package com.codenetworkz.blog.models;

public enum Status {

    YES("Y"), NO("N");
    private final String dbValue;

    Status(String dbValue) {
        this.dbValue = dbValue;
    }

    public String getDbValue() {
        return dbValue;
    }

    public static Status fromDbValue(String dbValue) {
        for (Status status : values()) {
            if (status.dbValue.equals(dbValue)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown dbValue: " + dbValue);
    }
}
