// Path: src/protocolsupportpocketstuff/util/GsonUtils.java
// public class GsonUtils {
// 	public static final Gson GSON = new Gson();
// 	public static final JsonParser JSON_PARSER = new JsonParser();
// }


import protocolsupport.libs.com.google.gson.JsonObject;
import protocolsupportpocketstuff.util.GsonUtils;
package protocolsupportpocketstuff.api.modals;


public enum ModalType {

	/***
	 * Simple modal. Always has true / false buttons.<br/>
	 * Implementation: {@link ModalWindow}
	 */
	MODAL_WINDOW("modal"),

	/***
	 * Simple form. Multiple buttons with possible images.<br/>
	 * Implementation: {@link SimpleForm}
	 */
	SIMPLE_FORM("form"),

	/***
	 * Complex form. All kinds of cool and custom stuff.<br/>
	 * Implementation: {@link ComplexForm}
	 */
	COMPLEX_FORM("custom_form"),

	/***
	 * Returned when no formtype could be identified.
	 * Might also be returned on event / callback.
	 */
	UNKNOWN("unknown");

	private final String peName;

	ModalType(String peName) {
		this.peName = peName;
	}

	/***
	 * @return the PE name of the modal type.
	 */
	public String getPeName() {
		return peName;
	}

	/***
	 * Gets a ModalType from its PE name.
	 * @param peName
	 * @return
	 */
	public static ModalType getByPeName(String peName) {
		for (ModalType type : ModalType.values()) {
			if (type.getPeName().equals(peName)) {
				return type;
			}
		}
		return UNKNOWN;
	}

	/***
	 * Gets the ModalType from a json modal. 
	 * @param modalJSON
	 * @return the modalType.
	 */
	public static ModalType fromModal(String modalJSON) {
// Path: src/protocolsupportpocketstuff/util/GsonUtils.java
// public class GsonUtils {
// 	public static final Gson GSON = new Gson();
// 	public static final JsonParser JSON_PARSER = new JsonParser();
// }


// Path: src/protocolsupportpocketstuff/api/modals/ModalType.java
import protocolsupport.libs.com.google.gson.JsonObject;
import protocolsupportpocketstuff.util.GsonUtils;

package protocolsupportpocketstuff.api.modals;


public enum ModalType {

	/***
	 * Simple modal. Always has true / false buttons.<br/>
	 * Implementation: {@link ModalWindow}
	 */
	MODAL_WINDOW("modal"),

	/***
	 * Simple form. Multiple buttons with possible images.<br/>
	 * Implementation: {@link SimpleForm}
	 */
	SIMPLE_FORM("form"),

	/***
	 * Complex form. All kinds of cool and custom stuff.<br/>
	 * Implementation: {@link ComplexForm}
	 */
	COMPLEX_FORM("custom_form"),

	/***
	 * Returned when no formtype could be identified.
	 * Might also be returned on event / callback.
	 */
	UNKNOWN("unknown");

	private final String peName;

	ModalType(String peName) {
		this.peName = peName;
	}

	/***
	 * @return the PE name of the modal type.
	 */
	public String getPeName() {
		return peName;
	}

	/***
	 * Gets a ModalType from its PE name.
	 * @param peName
	 * @return
	 */
	public static ModalType getByPeName(String peName) {
		for (ModalType type : ModalType.values()) {
			if (type.getPeName().equals(peName)) {
				return type;
			}
		}
		return UNKNOWN;
	}

	/***
	 * Gets the ModalType from a json modal. 
	 * @param modalJSON
	 * @return the modalType.
	 */
	public static ModalType fromModal(String modalJSON) {
		JsonObject jsonParser = GsonUtils.JSON_PARSER.parse(modalJSON).getAsJsonObject();