package com.tomastc.anickd;

import org.json.JSONException;
import org.json.JSONObject;

public class WsProtocol {
    public static String encapsulation(String cmd, JSONObject ext) {
        String tmp = "";
        try {
            JSONObject json = new JSONObject();
            json.put("cmd", cmd);
            if (ext != null) {
                json.put("ext", ext);
            }

            tmp = json.toString();
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return tmp;
    }

    public static String encapsulation(String cmd) {
        return encapsulation(cmd, null);
    }

    public enum EVENT {


        HT_LOGIN_OPEN,
        HT_LOGIN_FAILED,
        HT_LOGIN_SUCCESS,
        HT_RECEIVING_OPEN,
        HT_RECEIVING_SCAN_STEP1,
        HT_RECEIVING_SCAN_STEP1_FAILED,
        HT_RECEIVING_SCAN_STEP1_SUCCESS,
        HT_RECEIVING_SCAN_STEP2,
        HT_RECEIVING_SCAN_STEP2_FAILED,
        HT_RECEIVING_SCAN_STEP2_SUCCESS,
        HT_RECEIVING_CHECKPOINT,
        HT_RECEIVING_CHECKPOINT_FAILED,
        HT_RECEIVING_CHECKPOINT_SUCCESS,
        HT_RECEIVING_PENDING,
        HT_RECEIVING_NG,
        HT_STAGING_OPEN,
        HT_STAGING_SCAN_STEP1,
        HT_STAGING_SCAN_STEP1_FAILED,
        HT_STAGING_SCAN_STEP1_SUCCESS,
        HT_STAGING_CHECKPOINT,
        HT_STAGING_CHECKPOINT_FAILED,
        HT_STAGING_CHECKPOINT_SUCCESS,
        HT_STAGING_PENDING,
        HT_STAGING_NG,
        HT_OUTER_PACKING_OPEN,
        HT_OUTER_PACKING_SCAN_STEP1,
        HT_OUTER_PACKING_SCAN_STEP1_FAILED,
        HT_OUTER_PACKING_SCAN_STEP1_SUCCESS,
        HT_OUTER_PACKING_SCAN_STEP2,
        HT_OUTER_PACKING_SCAN_STEP2_FAILED,
        HT_OUTER_PACKING_SCAN_STEP2_SUCCESS,
        HT_OUTER_PACKING_SCAN_STEP3,
        HT_OUTER_PACKING_SCAN_STEP3_FAILED,
        HT_OUTER_PACKING_SCAN_STEP3_SUCCESS,
        HT_OUTER_PACKING_PENDING,
        HT_OUTER_PACKING_NG,
        HT_UNLOCK_SCREEN_OPEN,
        HT_UNLOCK_SCREEN_FAILED,
        HT_UNLOCK_SCREEN_SUCCESS,
        HT_LOGOUT,
        TB_STAGING_MONITOR_MEIJI_CARD_SUCCESS,
        WB_CHECKPOINT_DATA_NOT_FOUND,
        WB_INVALID_WORKING_STEP,
        WB_INVALID_CUTPART,

        HT_OUTER_PACKING_SUB_LEADER_CONFIRM_FAILED,
        HT_OUTER_PACKING_SUB_LEADER_CONFIRM_SUCCESS,
        HT_OUTER_PACKING_LEADER_CONFIRM_FAILED,
        HT_OUTER_PACKING_LEADER_CONFIRM_SUCCESS,
        HT_OUTER_PACKING_STOP_CASE_FAILED,
        HT_OUTER_PACKING_STOP_CASE_SUCCESS,
        TB_OUTER_PACKING_SUB_LEADER_CONFIRM_OPEN,
        TB_OUTER_PACKING_LEADER_CONFIRM_OPEN,
        TB_OUTER_PACKING_STOP_CASE_OPEN,
        HT_PRINT_TAG_RECEIVE_OPEN,
        HT_PRINT_TAG_RECEIVE_SCAN_STEP1,
        HT_PRINT_TAG_RECEIVE_SCAN_STEP1_SUCCESS,
        HT_PRINT_TAG_RECEIVE_SCAN_STEP1_SUCCESS_ACK,
        HT_PRINT_TAG_RECEIVE_SCAN_STEP1_FAILED,

        HT_REPRINT_TAG_RECEIVE_LEADER_CONFIRM_SUCCESS,
        HT_PRINT_TEMPORARY_TAG_OPEN,
        HT_PRINT_TEMPORARY_TAG_SCAN_STEP1,
        HT_REPRINT_TAG_RECEIVE_LEADER_CONFIRM_SUCCESS_ACK,
        HT_PRINT_TEMPORARY_TAG_SCAN_STEP1_SUCCESS,
        HT_PRINT_TEMPORARY_TAG_SCAN_STEP1_FAILED,
        HT_PRINT_TEMPORARY_TAG_SCAN_STEP1_SUCCESS_ACK

    }

    public enum COMMAND {

        HELLO,
        GET_USER_REQUEST,
        GET_USER_ACK,
        GET_ERROR_CODE_TABLE_REQUEST,
        GET_ERROR_CODE_TABLE_ACK,
        REGISTER_REQUEST,
        REGISTER_ACK,
        UNREGISTER_REQUEST,
        UNREGISTER_ACK,
        GET_DEVICE_LIST_REQUEST,
        GET_DEVICE_LIST_ACK,
        GET_PAIRED_MEIJI_CARD_DISPLAY_REQUEST,
        GET_PAIRED_MEIJI_CARD_DISPLAY_ACK,
        GET_PAIRED_DEVICE_REQUEST,
        GET_PAIRED_DEVICE_ACK,
        MEIJI_CARD_DISPLAY_REQUEST,
        MEIJI_CARD_DISPLAY_ACK,
        MEIJI_CARD_READY_REQUEST,
        MEIJI_CARD_READY_ACK,
        RECEIVING_SCAN_STEP1_REQUEST,
        RECEIVING_SCAN_STEP1_ACK,
        RECEIVING_SCAN_STEP2_REQUEST,
        RECEIVING_SCAN_STEP2_ACK,
        EVENT_LOG_REQUEST,
        EVENT_LOG_ACK,
        DATA_REDRAW_REQUEST,
        DATA_REDRAW_ACK,
        DEVICE_PAIRING_REQUEST,
        DEVICE_PAIRING_ACK,
        DEVICE_PAIRING_NOTIFY_REQUEST,
        DEVICE_PAIRING_NOTIFY_ACK,
        DEVICE_CONNECT_NOTIFY_REQUEST,
        DEVICE_CONNECT_NOTIFY_ACK,
        DEVICE_DISCONNECT_NOTIFY_REQUEST,
        DEVICE_DISCONNECT_NOTIFY_ACK,
        SET_AREA_REQUEST,
        SET_AREA_ACK,
        SET_MODE_REQUEST,
        SET_MODE_ACK,
        PING,
        PONG,
        RESET_REQUEST,
        RESET_ACK
    }
}


