package ru.ulstu.core.model;

public enum ErrorConstants {
    UNKNOWN(0, "Unknown error"),
    ID_IS_NULL(1, "Id of entity has null value"),
    VALIDATION_ERROR(2, "Validation error"),
    USER_ID_EXISTS(100, "New user can't have id"),
    USER_ACTIVATION_ERROR(101, "Invalid activation key"),
    USER_EMAIL_EXISTS(102, "User with same email already exists"),
    USER_LOGIN_EXISTS(103, "User with same login already exists"),
    USER_PASSWORDS_NOT_VALID_OR_NOT_MATCH(104, "User passwords is not valid or not match"),
    USER_NOT_FOUND(105, "User is not found"),
    USER_NOT_ACTIVATED(106, "User is not activated"),
    USER_RESET_ERROR(107, "Invalid reset key"),
    USER_UNDEAD_ERROR(108, "Can't edit/delete that user"),
    FILE_UPLOAD_ERROR(110, "File upload error");

    private int code;
    private String message;

    ErrorConstants(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    @Override
    public String toString() {
        return String.format("%d: %s", code, message);
    }
}
