// Path: app/src/main/java/se/oort/diplicity/apigen/Game.java
// public class Game implements java.io.Serializable {
//   public String ID;
//   public Boolean Started;
//   public Boolean Closed;
//   public Boolean Finished;
//   public String Desc;
//   public String Variant;
//   public Long PhaseLengthMinutes;
//   public Long NonMovementPhaseLengthMinutes;
//   public Double MaxHated;
//   public Double MaxHater;
//   public Double MinRating;
//   public Double MaxRating;
//   public Double MinReliability;
//   public Double MinQuickness;
//   public Boolean Private;
//   public Boolean NoMerge;
//   public Boolean DisableConferenceChat;
//   public Boolean DisableGroupChat;
//   public Boolean DisablePrivateChat;
//   public Long NationAllocation;
//   public Boolean Anonymous;
//   public Long LastYear;
//   public Long NMembers;
//   public java.util.List<Member> Members;
//   public java.util.Date StartETA;
//   public java.util.List<PhaseMeta> NewestPhaseMeta;
//   public java.util.List<Ban> ActiveBans;
//   public java.util.List<String> FailedRequirements;
//   public Member FirstMember;
//   public java.util.Date CreatedAt;
//   public Ticker CreatedAgo;
//   public java.util.Date StartedAt;
//   public Ticker StartedAgo;
//   public java.util.Date FinishedAt;
//   public Ticker FinishedAgo;
// }
// 
// Path: app/src/main/java/se/oort/diplicity/apigen/Member.java
// public class Member implements java.io.Serializable {
//   public User User;
//   public String Nation;
//   public String GameAlias;
//   public String NationPreferences;
//   public PhaseState NewestPhaseState;
//   public Long UnreadMessages;
// }


import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.SystemClock;
import android.util.Log;
import com.google.gson.Gson;
import java.util.Date;
import java.util.Map;
import se.oort.diplicity.apigen.Game;
import se.oort.diplicity.apigen.Member;
import static se.oort.diplicity.R.menu.game;
package se.oort.diplicity;






public class Alarm extends BroadcastReceiver {

    public static final String GAME_ID_KEY = "game_id";
    public static final String GAME_DESC_KEY = "game_desc";
    public static final String GAME_DEADLINE_KEY = "game_deadline";
    public static final String DEADLINE_WARNING_ACTION = "se.oort.diplicity.DeadlineWarning";
    public static final String ALARM_PREFERENCES = "alarm_preferences";

    public static class Alert {
        Date deadlineAt;
        String desc;
        String id;
        public Date alertAt(Context context) {
            if (App.getDeadlineWarningDebug(context)) {
                return new Date(new Date().getTime() + 5 * 1000);
            } else {
                return new Date(deadlineAt.getTime() - (App.getDeadlineWarningMinutes(context) * 60 * 1000));
            }
        }
        public static Alert fromJSON(String s) {
            return new Gson().fromJson(s, Alert.class);
        }
// Path: app/src/main/java/se/oort/diplicity/apigen/Game.java
// public class Game implements java.io.Serializable {
//   public String ID;
//   public Boolean Started;
//   public Boolean Closed;
//   public Boolean Finished;
//   public String Desc;
//   public String Variant;
//   public Long PhaseLengthMinutes;
//   public Long NonMovementPhaseLengthMinutes;
//   public Double MaxHated;
//   public Double MaxHater;
//   public Double MinRating;
//   public Double MaxRating;
//   public Double MinReliability;
//   public Double MinQuickness;
//   public Boolean Private;
//   public Boolean NoMerge;
//   public Boolean DisableConferenceChat;
//   public Boolean DisableGroupChat;
//   public Boolean DisablePrivateChat;
//   public Long NationAllocation;
//   public Boolean Anonymous;
//   public Long LastYear;
//   public Long NMembers;
//   public java.util.List<Member> Members;
//   public java.util.Date StartETA;
//   public java.util.List<PhaseMeta> NewestPhaseMeta;
//   public java.util.List<Ban> ActiveBans;
//   public java.util.List<String> FailedRequirements;
//   public Member FirstMember;
//   public java.util.Date CreatedAt;
//   public Ticker CreatedAgo;
//   public java.util.Date StartedAt;
//   public Ticker StartedAgo;
//   public java.util.Date FinishedAt;
//   public Ticker FinishedAgo;
// }
// 
// Path: app/src/main/java/se/oort/diplicity/apigen/Member.java
// public class Member implements java.io.Serializable {
//   public User User;
//   public String Nation;
//   public String GameAlias;
//   public String NationPreferences;
//   public PhaseState NewestPhaseState;
//   public Long UnreadMessages;
// }


// Path: app/src/main/java/se/oort/diplicity/Alarm.java
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.SystemClock;
import android.util.Log;
import com.google.gson.Gson;
import java.util.Date;
import java.util.Map;
import se.oort.diplicity.apigen.Game;
import se.oort.diplicity.apigen.Member;
import static se.oort.diplicity.R.menu.game;

package se.oort.diplicity;






public class Alarm extends BroadcastReceiver {

    public static final String GAME_ID_KEY = "game_id";
    public static final String GAME_DESC_KEY = "game_desc";
    public static final String GAME_DEADLINE_KEY = "game_deadline";
    public static final String DEADLINE_WARNING_ACTION = "se.oort.diplicity.DeadlineWarning";
    public static final String ALARM_PREFERENCES = "alarm_preferences";

    public static class Alert {
        Date deadlineAt;
        String desc;
        String id;
        public Date alertAt(Context context) {
            if (App.getDeadlineWarningDebug(context)) {
                return new Date(new Date().getTime() + 5 * 1000);
            } else {
                return new Date(deadlineAt.getTime() - (App.getDeadlineWarningMinutes(context) * 60 * 1000));
            }
        }
        public static Alert fromJSON(String s) {
            return new Gson().fromJson(s, Alert.class);
        }
        public static Alert fromGame(Game game, Member member) {