package org.academiadecodigo.enuminatti.webserver;

/**
 * MIT License
 * (c) 2017 Ricardo Constantino
 */

public enum Status {
    OK(200, "OK"),

    REDIRECT_PERMANENT(301, "Moved Permanently"),
    REDIRECT(307, "Moved Temporarily"),

    BAD_REQUEST(400, "Bad Request"),
    NOT_FOUND(404, "Not Found"),
    METHOD_NOT_ALLOWED(405, "Method Not Allowed"),

    INTERNAL_ERROR(500, "Internal Error"),
    NOT_IMPLEMENTED(501, "Not Implemented");

    private int code;
    private String name;

    Status(int code, String name) {

        this.code = code;
        this.name = name;

    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public String getResponseLine() {
        return "HTTP/1.1 " + code + " " + name;
    }
}
