package com.xamoom.android.xamoomsdk.PushDevice;

import com.google.gson.annotations.SerializedName;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

import at.rags.morpheus.Resource;

public class PushDevice extends Resource {
  @SerializedName("id")
  private String uid;
  @SerializedName("os")
  private String os;
  @SerializedName("app-version")
  private String appVersion;
  @SerializedName("app-id")
  private String appId;
  @SerializedName("location")
  private Map<String, Float> location;
  @SerializedName("last-app-open")
  private String lastOpen;
  @SerializedName("updated-at")
  private String updatedAt;
  @SerializedName("created-at")
  private String createdAt;

  public PushDevice() {
  }

  public PushDevice(String token, Map<String, Float> location, String appVersion, String appId) {
    this.uid = token;
    this.os = "Android";
    this.appVersion = appVersion;
    this.appId = appId;
    this.location = location;
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.UK);
    String formattedDate = sdf.format(new Date());

    this.lastOpen = formattedDate;
    this.updatedAt = "";
    this.createdAt = "";
  }

  public String getUid() {
    return uid;
  }

  public void setUid(String uid) {
    this.uid = uid;
  }

  public String getOs() {
    return os;
  }

  public void setOs(String os) {
    this.os = os;
  }

  public String getAppVersion() {
    return appVersion;
  }

  public void setAppVersion(String appVersion) {
    this.appVersion = appVersion;
  }

  public String getAppId() {
    return appId;
  }

  public void setAppId(String appId) {
    this.appId = appId;
  }

  public Map<String, Float> getLocation() {
    return location;
  }

  public void setLocation(Map<String, Float> location) {
    this.location = location;
  }

  public String getLastOpen() {
    return lastOpen;
  }

  public void setLastOpen(String lastOpen) {
    this.lastOpen = lastOpen;
  }

  public String getUpdatedAt() {
    return updatedAt;
  }

  public void setUpdatedAt(String updatedAt) {
    this.updatedAt = updatedAt;
  }

  public String getCreatedAt() {
    return createdAt;
  }

  public void setCreatedAt(String createdAt) {
    this.createdAt = createdAt;
  }
}
@@ -39,24 +39,65 @@
 ushDevice;%0A%0A
+import android.annotation.SuppressLint;%0A%0A
 import com.g
@@ -135,16 +135,16 @@
 edName;%0A
-
 %0Aimport 
@@ -266,16 +266,43 @@
 til.Map;
+%0Aimport java.util.TimeZone;
 %0A%0Aimport
@@ -834,37 +834,8 @@
 t;%0A%0A
-  public PushDevice() %7B%0A  %7D%0A%0A
   pu
@@ -1059,24 +1059,25 @@
 = location;%0A
+%0A
     SimpleDa
@@ -1140,19 +1140,58 @@
 ssZ%22
-, Locale.UK
+);%0A    sdf.setTimeZone(TimeZone.getTimeZone(%22UTC%22)
 );%0A 

Send UTC time for last_open in PushDevice