package org.wso2.carbon.device.mgt.ios.api.utils.util;

public enum OperationMapping {

    //TODO Refactor these codes
    INSTALL_STORE_APPLICATION("INSTALL_STORE_APPLICATION", OperationMapping.MDM_PUSH),
    INSTALL_ENTERPRISE_APPLICATION("INSTALL_ENTERPRISE_APPLICATION", OperationMapping.MDM_PUSH),
    REMOVE_APPLICATION("REMOVE_APPLICATION", OperationMapping.MDM_PUSH),
    DEVICE_LOCK("DEVICE_LOCK", OperationMapping.MDM_PUSH),
    APPLICATION_LIST("APPLICATION_LIST", OperationMapping.MDM_PUSH),
    PROFILE_LIST("PROFILE_LIST", OperationMapping.MDM_PUSH),
    POLICY_REVOKE("POLICY_REVOKE", OperationMapping.MDM_PUSH),
    CLEAR_PASSCODE("CLEAR_PASSCODE", OperationMapping.MDM_PUSH),
    CELLULAR("CELLULAR", OperationMapping.MDM_PUSH),
    ENTERPRISE_WIPE("ENTERPRISE_WIPE", OperationMapping.MDM_PUSH),
    APN("APN", OperationMapping.MDM_PUSH),
    CALDAV("CALDAV", OperationMapping.MDM_PUSH),
    CALENDAR_SUBSCRIPTION("CALENDAR_SUBSCRIPTION", OperationMapping.MDM_PUSH),
    PASSCODE_POLICY("PASSCODE_POLICY", OperationMapping.MDM_PUSH),
    EMAIL("EMAIL", OperationMapping.MDM_PUSH),
    RESTRICTION("RESTRICTION", OperationMapping.MDM_PUSH),
    LDAP("LDAP", OperationMapping.MDM_PUSH),
    WIFI("WIFI", OperationMapping.MDM_PUSH),
    WEB_CLIP("WEB_CLIP", OperationMapping.MDM_PUSH),
    VPN("VPN", OperationMapping.MDM_PUSH),
    APP_LOCK("APP_LOCK", OperationMapping.MDM_PUSH),
    PER_APP_VPN("PER_APP_VPN", OperationMapping.MDM_PUSH),
    APP_TO_PER_APP_VPN_MAPPING("APP_TO_PER_APP_VPN_MAPPING", OperationMapping.MDM_PUSH),
    DEVICE_INFO("DEVICE_INFO", OperationMapping.MDM_PUSH),
    GET_RESTRICTIONS("GET_RESTRICTIONS", OperationMapping.MDM_PUSH),
    AIR_PLAY("AIR_PLAY", OperationMapping.MDM_PUSH),
    DOMAIN("DOMAIN", OperationMapping.MDM_PUSH),
    DEVICE_LOCATION("DEVICE_LOCATION", OperationMapping.SILENT_PUSH),
    RING("RING", OperationMapping.SILENT_PUSH),
    NOTIFICATION("NOTIFICATION", OperationMapping.NORMAL_PUSH),
    POLICY_BUNDLE("POLICY_BUNDLE", OperationMapping.MDM_PUSH),
    MONITOR("MONITOR", OperationMapping.MDM_PUSH),
    WIPE_DATA("WIPE_DATA", OperationMapping.MDM_PUSH);
    
    private String code;
    private String operationType;
    public static final String NORMAL_PUSH = "normal_push";
    public static final String MDM_PUSH = "mdm_push";
    public static final String SILENT_PUSH = "silent_push";

    private OperationMapping(String code, String operationType) {
        this.code = code;
        this.setOperationType(operationType);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getOperationType() {
        return operationType;
    }

    public void setOperationType(String operationType) {
        this.operationType = operationType;
    }

    public static OperationMapping getEnumByString(String code){
        for(OperationMapping operationMapping : OperationMapping.values()){
            if(operationMapping.code.equals(code)) {
                return operationMapping;
            }
        }

        return null;
    }
}
