// 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.Application;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.multidex.MultiDexApplication;
import android.util.Log;
import android.os.Build;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.CrashlyticsInitProvider;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import io.fabric.sdk.android.services.common.Crash;
import se.oort.diplicity.apigen.Game;
import se.oort.diplicity.apigen.Member;
                }
            });
        }
    }

    public static String millisToDuration(long millis) {
        return minutesToDuration((int) ((millis / (long) 1000) / (long) 60));
    }

    public static long getDeadlineWarningMinutes(Context context) {
        try {
            return Long.parseLong(PreferenceManager.getDefaultSharedPreferences(context).getString(context.getResources().getString(R.string.deadline_warning_minutes_key), "60"));
        } catch (NumberFormatException e) {
            return 0l;
        }
    }

    public static boolean getDeadlineWarningDebug(Context context) {
        return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getResources().getString(R.string.deadline_warning_debug_pref_key), false);
    }

    public static Member getMemberByUser(Game game, String userId) {
        for (Member m : game.Members) {
            if (m.User.Id.equals(userId)) {
                return m;
            }
        }
        return null;
    }

// 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/App.java
import android.app.Application;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.multidex.MultiDexApplication;
import android.util.Log;
import android.os.Build;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.CrashlyticsInitProvider;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import io.fabric.sdk.android.services.common.Crash;
import se.oort.diplicity.apigen.Game;
import se.oort.diplicity.apigen.Member;

                }
            });
        }
    }

    public static String millisToDuration(long millis) {
        return minutesToDuration((int) ((millis / (long) 1000) / (long) 60));
    }

    public static long getDeadlineWarningMinutes(Context context) {
        try {
            return Long.parseLong(PreferenceManager.getDefaultSharedPreferences(context).getString(context.getResources().getString(R.string.deadline_warning_minutes_key), "60"));
        } catch (NumberFormatException e) {
            return 0l;
        }
    }

    public static boolean getDeadlineWarningDebug(Context context) {
        return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getResources().getString(R.string.deadline_warning_debug_pref_key), false);
    }

    public static Member getMemberByUser(Game game, String userId) {
        for (Member m : game.Members) {
            if (m.User.Id.equals(userId)) {
                return m;
            }
        }
        return null;
    }

    public static Member getMemberByNation(Game game, String nation) {