/**
 * Copyright (c) 2000-2017 Liferay, Inc. All rights reserved.
 *
 * The contents of this file are subject to the terms of the Liferay Enterprise
 * pSubscription License ("License"). You may not use this file except in
 * compliance with the License. You can obtain a copy of the License by
 * contacting Liferay, Inc. See the License for the specific language governing
 * permissions and limitations under the License, including but not limited to
 * distribution rights of the Software.
 *
 *
 *
 */

package com.liferay.portal.kernel.license.messaging;

/**
 * @author Igor Beslic
 */
public enum LCSPortletState {

	GOOD(1), NO_AVAILABLE_SERVERS(2), NO_CONNECTION(3), NOT_REGISTERED(5),
	NO_SUBSCRIPTION(4), PLUGIN_ABSENT(0), UNDEFINED(Integer.MAX_VALUE);

	public static LCSPortletState valueOf(int intValue) {
		if (intValue == 0) {
			return PLUGIN_ABSENT;
		}
		else if (intValue == 1) {
			return GOOD;
		}
		else if (intValue == 2) {
			return NO_AVAILABLE_SERVERS;
		}
		else if (intValue == 3) {
			return NO_CONNECTION;
		}
		else if (intValue == 4) {
			return NO_SUBSCRIPTION;
		}
		else if (intValue == 5) {
			return NOT_REGISTERED;
		}

		return UNDEFINED;
	}

	public int intValue() {
		return _state;
	}

	private LCSPortletState(int state) {
		_state = state;
	}

	private final int _state;

}