// Path: backbone/src/main/java/org/researchstack/backbone/storage/database/TaskNotification.java
// @DatabaseTable
// public class TaskNotification implements Serializable {
//     @DatabaseField(generatedId = true)
//     public int id;
// 
//     @DatabaseField
//     public Date endDate;
// 
//     @DatabaseField
//     public String chronTime;
// }
// 
// Path: backbone/src/main/java/org/researchstack/backbone/utils/FormatHelper.java
// public class FormatHelper {
// 
//     public static final int NONE = -1;
//     public static final String DATE_FORMAT_ISO_8601 = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
//     public static final SimpleDateFormat DEFAULT_FORMAT = new SimpleDateFormat(FormatHelper.DATE_FORMAT_ISO_8601,
//             Locale.getDefault());
//     public static final String DATE_FORMAT_SIMPLE_DATE = "yyyy-MM-dd";
//     public static final SimpleDateFormat SIMPLE_FORMAT_DATE = new SimpleDateFormat(
//             DATE_FORMAT_SIMPLE_DATE,
//             Locale.getDefault());
//     private FormatHelper() {
//     }
// 
//     /**
//      * Helper method to return a formatter suitable for
//      * {@link ConsentSignatureStepLayout}
//      *
//      * @return DateFormat that is a DateInstance (only formats y, m, and d attributes)
//      */
//     public static DateFormat getSignatureFormat() {
//         return getFormat(DateFormat.SHORT, NONE);
//     }
// 
//     /**
//      * Returns a DateFormat object based on the dateStyle and timeStyle params
//      *
//      * @param dateStyle style for the date defined by static constants within {@link DateFormat}
//      * @param timeStyle style for the time defined by static constants within {@link DateFormat}
//      * @return DateFormat object
//      */
//     public static DateFormat getFormat(int dateStyle, int timeStyle) {
//         // Date & Time format
//         if (isStyle(dateStyle) && isStyle(timeStyle)) {
//             return DateFormat.getDateTimeInstance(dateStyle, timeStyle);
//         }
// 
//         // Date format
//         else if (isStyle(dateStyle) && !isStyle(timeStyle)) {
//             return DateFormat.getDateInstance(dateStyle);
//         }
// 
//         // Time format
//         else if (!isStyle(dateStyle) && isStyle(timeStyle)) {
//             return DateFormat.getTimeInstance(timeStyle);
//         }
// 
//         // Else crash since the styles are invalid
//         else {
//             throw new IllegalArgumentException("dateStyle and timeStyle cannot both be ");
//         }
//     }
// 
//     public static boolean isStyle(int style) {
//         return style >= DateFormat.FULL && style <= DateFormat.SHORT;
//     }
// 
// }
// 
// Path: backbone/src/main/java/org/researchstack/backbone/utils/ObservableUtils.java
// public class ObservableUtils {
//     private ObservableUtils() {
//     }
// 
//     public static <T> Observable.Transformer<T, T> applyDefault() {
//         return observable -> observable.subscribeOn(Schedulers.io())
//                 .observeOn(AndroidSchedulers.mainThread());
//     }
// }


import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import org.researchstack.backbone.storage.NotificationHelper;
import org.researchstack.backbone.storage.database.TaskNotification;
import org.researchstack.backbone.utils.FormatHelper;
import org.researchstack.backbone.utils.LogExt;
import org.researchstack.backbone.utils.ObservableUtils;
import org.researchstack.skin.UiManager;
import org.researchstack.skin.schedule.ScheduleHelper;
import java.text.DateFormat;
import java.util.Date;
import java.util.List;
import rx.Observable;
package org.researchstack.skin.notification;






public class TaskAlertReceiver extends BroadcastReceiver {
    //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    // Intent Actions
    //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    public static final String ALERT_CREATE = "org.researchstack.skin.notification.ALERT_CREATE";
    public static final String ALERT_CREATE_ALL = "org.researchstack.skin.notification.ALERT_CREATE_ALL";
    public static final String ALERT_DELETE = "org.researchstack.skin.notification.ALERT_DELETE";
    public static final String ALERT_DELETE_ALL = "org.researchstack.skin.notification.ALERT_DELETE_ALL";

    //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    // Intent Keys
    //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    public static final String KEY_NOTIFICATION = "CreateAlertReceiver.KEY_NOTIFICATION";
    public static final String KEY_NOTIFICATION_ID = "CreateAlertReceiver.KEY_NOTIFICATION_ID";

    public static Intent createDeleteIntent(int notificationId) {
        Intent deleteTaskIntent = new Intent(TaskAlertReceiver.ALERT_DELETE);
        deleteTaskIntent.putExtra(TaskAlertReceiver.KEY_NOTIFICATION_ID, notificationId);
        return deleteTaskIntent;
    }

    public void onReceive(Context context, Intent intent) {
        Log.i("CreateAlertReceiver", "onReceive() _ " + intent.getAction());

        switch (intent.getAction()) {
            case ALERT_CREATE:
// Path: backbone/src/main/java/org/researchstack/backbone/storage/database/TaskNotification.java
// @DatabaseTable
// public class TaskNotification implements Serializable {
//     @DatabaseField(generatedId = true)
//     public int id;
// 
//     @DatabaseField
//     public Date endDate;
// 
//     @DatabaseField
//     public String chronTime;
// }
// 
// Path: backbone/src/main/java/org/researchstack/backbone/utils/FormatHelper.java
// public class FormatHelper {
// 
//     public static final int NONE = -1;
//     public static final String DATE_FORMAT_ISO_8601 = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
//     public static final SimpleDateFormat DEFAULT_FORMAT = new SimpleDateFormat(FormatHelper.DATE_FORMAT_ISO_8601,
//             Locale.getDefault());
//     public static final String DATE_FORMAT_SIMPLE_DATE = "yyyy-MM-dd";
//     public static final SimpleDateFormat SIMPLE_FORMAT_DATE = new SimpleDateFormat(
//             DATE_FORMAT_SIMPLE_DATE,
//             Locale.getDefault());
//     private FormatHelper() {
//     }
// 
//     /**
//      * Helper method to return a formatter suitable for
//      * {@link ConsentSignatureStepLayout}
//      *
//      * @return DateFormat that is a DateInstance (only formats y, m, and d attributes)
//      */
//     public static DateFormat getSignatureFormat() {
//         return getFormat(DateFormat.SHORT, NONE);
//     }
// 
//     /**
//      * Returns a DateFormat object based on the dateStyle and timeStyle params
//      *
//      * @param dateStyle style for the date defined by static constants within {@link DateFormat}
//      * @param timeStyle style for the time defined by static constants within {@link DateFormat}
//      * @return DateFormat object
//      */
//     public static DateFormat getFormat(int dateStyle, int timeStyle) {
//         // Date & Time format
//         if (isStyle(dateStyle) && isStyle(timeStyle)) {
//             return DateFormat.getDateTimeInstance(dateStyle, timeStyle);
//         }
// 
//         // Date format
//         else if (isStyle(dateStyle) && !isStyle(timeStyle)) {
//             return DateFormat.getDateInstance(dateStyle);
//         }
// 
//         // Time format
//         else if (!isStyle(dateStyle) && isStyle(timeStyle)) {
//             return DateFormat.getTimeInstance(timeStyle);
//         }
// 
//         // Else crash since the styles are invalid
//         else {
//             throw new IllegalArgumentException("dateStyle and timeStyle cannot both be ");
//         }
//     }
// 
//     public static boolean isStyle(int style) {
//         return style >= DateFormat.FULL && style <= DateFormat.SHORT;
//     }
// 
// }
// 
// Path: backbone/src/main/java/org/researchstack/backbone/utils/ObservableUtils.java
// public class ObservableUtils {
//     private ObservableUtils() {
//     }
// 
//     public static <T> Observable.Transformer<T, T> applyDefault() {
//         return observable -> observable.subscribeOn(Schedulers.io())
//                 .observeOn(AndroidSchedulers.mainThread());
//     }
// }


// Path: skin/src/main/java/org/researchstack/skin/notification/TaskAlertReceiver.java
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import org.researchstack.backbone.storage.NotificationHelper;
import org.researchstack.backbone.storage.database.TaskNotification;
import org.researchstack.backbone.utils.FormatHelper;
import org.researchstack.backbone.utils.LogExt;
import org.researchstack.backbone.utils.ObservableUtils;
import org.researchstack.skin.UiManager;
import org.researchstack.skin.schedule.ScheduleHelper;
import java.text.DateFormat;
import java.util.Date;
import java.util.List;
import rx.Observable;

package org.researchstack.skin.notification;






public class TaskAlertReceiver extends BroadcastReceiver {
    //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    // Intent Actions
    //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    public static final String ALERT_CREATE = "org.researchstack.skin.notification.ALERT_CREATE";
    public static final String ALERT_CREATE_ALL = "org.researchstack.skin.notification.ALERT_CREATE_ALL";
    public static final String ALERT_DELETE = "org.researchstack.skin.notification.ALERT_DELETE";
    public static final String ALERT_DELETE_ALL = "org.researchstack.skin.notification.ALERT_DELETE_ALL";

    //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    // Intent Keys
    //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    public static final String KEY_NOTIFICATION = "CreateAlertReceiver.KEY_NOTIFICATION";
    public static final String KEY_NOTIFICATION_ID = "CreateAlertReceiver.KEY_NOTIFICATION_ID";

    public static Intent createDeleteIntent(int notificationId) {
        Intent deleteTaskIntent = new Intent(TaskAlertReceiver.ALERT_DELETE);
        deleteTaskIntent.putExtra(TaskAlertReceiver.KEY_NOTIFICATION_ID, notificationId);
        return deleteTaskIntent;
    }

    public void onReceive(Context context, Intent intent) {
        Log.i("CreateAlertReceiver", "onReceive() _ " + intent.getAction());

        switch (intent.getAction()) {
            case ALERT_CREATE:
                TaskNotification taskNotification = (TaskNotification) intent.getSerializableExtra(