package com.jscape.inet.http.protocol.messages;

/**
 * @author Alex Usun
 */
public enum ProtocolVersion {

    HTTP_1_0("HTTP/1.0"),
    HTTP_1_1("HTTP/1.1");

    public final String value;
    
    public static ProtocolVersion versionFor(String value) {
        for (ProtocolVersion candidate : values()) {
            if (candidate.value.equals(value)) {
                return candidate;
            }
        }
        
        throw new IllegalArgumentException(String.format("Unsupported HTTP protocol version: %s.", value));
    }

    ProtocolVersion(String value) {
        this.value = value;
    }

}
