// Path: UserVoiceSDK/src/com/uservoice/uservoicesdk/babayaga/Babayaga.java
// public class Babayaga {
// 
//     static String DOMAIN = "by.uservoice.com";
//     public static String CHANNEL = "d";
//     public static String EXTERNAL_CHANNEL = "x";
// 
//     private static class Track {
//         public String event;
//         public Map<String, Object> eventProps;
// 
//         public Track(String event, Map<String, Object> eventProps) {
//             this.event = event;
//             this.eventProps = eventProps;
//         }
//     }
// 
//     private static String uvts;
//     private static SharedPreferences prefs;
// 
//     public enum Event {
//         VIEW_APP("g"),
//         VIEW_FORUM("m"),
//         VIEW_TOPIC("c"),
//         VIEW_KB("k"),
//         VIEW_CHANNEL("o"),
//         VIEW_IDEA("i"),
//         VIEW_ARTICLE("f"),
//         AUTHENTICATE("u"),
//         SEARCH_IDEAS("s"),
//         SEARCH_ARTICLES("r"),
//         VOTE_IDEA("v"),
//         VOTE_ARTICLE("z"),
//         SUBMIT_TICKET("t"),
//         SUBMIT_IDEA("d"),
//         SUBSCRIBE_IDEA("b"),
//         IDENTIFY("y"),
//         COMMENT_IDEA("h");
// 
//         private final String code;
// 
//         private Event(String code) {
//             this.code = code;
//         }
// 
//         public String getCode() {
//             return code;
//         }
//     }
// 
//     public static void setUvts(String uvts) {
//         Babayaga.uvts = uvts;
//         Editor edit = prefs.edit();
//         edit.putString("uvts", uvts);
//         edit.commit();
//     }
// 
//     public static void track(Context context, Event event) {
//         track(context, event, null);
//     }
// 
//     public static void track(Context context, Event event, String searchText, List<? extends BaseModel> results) {
//         Map<String, Object> props = new HashMap<String, Object>();
//         List<Integer> ids = new ArrayList<Integer>(results.size());
//         for (BaseModel model : results) {
//             ids.add(model.getId());
//         }
//         props.put("ids", ids);
//         props.put("text", searchText);
//         track(context, event, props);
//     }
// 
//     public static void track(Context context, Event event, int id) {
//         Map<String, Object> props = new HashMap<String, Object>();
//         props.put("id", id);
//         track(context, event, props);
//     }
// 
//     public static void track(Context context, Event event, Map<String, Object> eventProps) {
//         track(context, event.getCode(), eventProps);
//     }
// 
//     public static void track(Context context, String event, Map<String, Object> eventProps) {
//         // Log.d("UV", "BY flushing: " + event);
//         new BabayagaTask(context, event, uvts, eventProps).execute();
//     }
// 
//     public static void init(Context context) {
//         prefs = context.getSharedPreferences("uv", 0);
//         if (prefs.contains("uvts")) {
//             uvts = prefs.getString("uvts", null);
//         }
//         track(context, Event.VIEW_APP);
//     }
// 
//     public static String getUvts() {
//         return uvts;
//     }
// 
// }


import android.content.Context;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
import com.uservoice.uservoicesdk.rest.Callback;
import com.uservoice.uservoicesdk.rest.RestTaskCallback;
import com.uservoice.uservoicesdk.babayaga.Babayaga;
package com.uservoice.uservoicesdk.model;





public class Ticket extends BaseModel {

    public static void createTicket(Context context, String message, Map<String, String> customFields, final Callback<Ticket> callback) {
        createTicket(context, message, null, null, customFields, callback);
    }

    public static void createTicket(Context context, String message, String email, String name, Map<String, String> customFields, final Callback<Ticket> callback) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("ticket[message]", message);

        if (email != null)
            params.put("email", email);

        if (name != null)
            params.put("display_name", name);

// Path: UserVoiceSDK/src/com/uservoice/uservoicesdk/babayaga/Babayaga.java
// public class Babayaga {
// 
//     static String DOMAIN = "by.uservoice.com";
//     public static String CHANNEL = "d";
//     public static String EXTERNAL_CHANNEL = "x";
// 
//     private static class Track {
//         public String event;
//         public Map<String, Object> eventProps;
// 
//         public Track(String event, Map<String, Object> eventProps) {
//             this.event = event;
//             this.eventProps = eventProps;
//         }
//     }
// 
//     private static String uvts;
//     private static SharedPreferences prefs;
// 
//     public enum Event {
//         VIEW_APP("g"),
//         VIEW_FORUM("m"),
//         VIEW_TOPIC("c"),
//         VIEW_KB("k"),
//         VIEW_CHANNEL("o"),
//         VIEW_IDEA("i"),
//         VIEW_ARTICLE("f"),
//         AUTHENTICATE("u"),
//         SEARCH_IDEAS("s"),
//         SEARCH_ARTICLES("r"),
//         VOTE_IDEA("v"),
//         VOTE_ARTICLE("z"),
//         SUBMIT_TICKET("t"),
//         SUBMIT_IDEA("d"),
//         SUBSCRIBE_IDEA("b"),
//         IDENTIFY("y"),
//         COMMENT_IDEA("h");
// 
//         private final String code;
// 
//         private Event(String code) {
//             this.code = code;
//         }
// 
//         public String getCode() {
//             return code;
//         }
//     }
// 
//     public static void setUvts(String uvts) {
//         Babayaga.uvts = uvts;
//         Editor edit = prefs.edit();
//         edit.putString("uvts", uvts);
//         edit.commit();
//     }
// 
//     public static void track(Context context, Event event) {
//         track(context, event, null);
//     }
// 
//     public static void track(Context context, Event event, String searchText, List<? extends BaseModel> results) {
//         Map<String, Object> props = new HashMap<String, Object>();
//         List<Integer> ids = new ArrayList<Integer>(results.size());
//         for (BaseModel model : results) {
//             ids.add(model.getId());
//         }
//         props.put("ids", ids);
//         props.put("text", searchText);
//         track(context, event, props);
//     }
// 
//     public static void track(Context context, Event event, int id) {
//         Map<String, Object> props = new HashMap<String, Object>();
//         props.put("id", id);
//         track(context, event, props);
//     }
// 
//     public static void track(Context context, Event event, Map<String, Object> eventProps) {
//         track(context, event.getCode(), eventProps);
//     }
// 
//     public static void track(Context context, String event, Map<String, Object> eventProps) {
//         // Log.d("UV", "BY flushing: " + event);
//         new BabayagaTask(context, event, uvts, eventProps).execute();
//     }
// 
//     public static void init(Context context) {
//         prefs = context.getSharedPreferences("uv", 0);
//         if (prefs.contains("uvts")) {
//             uvts = prefs.getString("uvts", null);
//         }
//         track(context, Event.VIEW_APP);
//     }
// 
//     public static String getUvts() {
//         return uvts;
//     }
// 
// }


// Path: UserVoiceSDK/src/com/uservoice/uservoicesdk/model/Ticket.java
import android.content.Context;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
import com.uservoice.uservoicesdk.rest.Callback;
import com.uservoice.uservoicesdk.rest.RestTaskCallback;
import com.uservoice.uservoicesdk.babayaga.Babayaga;

package com.uservoice.uservoicesdk.model;





public class Ticket extends BaseModel {

    public static void createTicket(Context context, String message, Map<String, String> customFields, final Callback<Ticket> callback) {
        createTicket(context, message, null, null, customFields, callback);
    }

    public static void createTicket(Context context, String message, String email, String name, Map<String, String> customFields, final Callback<Ticket> callback) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("ticket[message]", message);

        if (email != null)
            params.put("email", email);

        if (name != null)
            params.put("display_name", name);

        if (Babayaga.getUvts() != null)