/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bytesw.bytebot.http.enums;

import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;

public enum ValidationStatusEnum {
    OK("OK"),
    ERROR("ERROR"),
    DATA_INCOMPLETE ("DI"),
    FORMAT_INCORRECT("FI"),
    INCOMPATIBLE_EXTENSION("IE"),
    HEADER_ERROR ("HE"), 
    CONTENT_ERROR("CE");

    private final String name;

    private static final Map<String, ValidationStatusEnum> map = new HashMap<>();

    static {
        for (ValidationStatusEnum type : ValidationStatusEnum.values()) {
            map.put(type.name, type);
        }
    }

    ValidationStatusEnum(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public static ValidationStatusEnum fromString(String name) {
        if (map.containsKey(name)) {
            return map.get(name);
        }
        throw new NoSuchElementException(name + " not found");
    }
}
