package com.ikea.shared.store.service;

import android.location.Location;
import android.text.TextUtils;
import com.google.gson.annotations.SerializedName;
import com.ikea.shared.stores.model.StoreList;
import com.ikea.shared.stores.model.StoreLocation;
import com.ikea.shared.stores.model.StoreRef;
import com.ikea.shared.stores.model.StoreRefList;
import com.ikea.shared.util.L;
import com.ikea.shared.util.Persistable;
import com.ikea.shared.util.Util;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

public class StoreCacheInfo
  implements Persistable
{

  @SerializedName("IsInStore")
  private boolean isInStore;

  @SerializedName("CountryCode")
  private String mCountryCode;

  @SerializedName("GeoStoreID")
  private String mGeoStoreId;

  @SerializedName("GeofenceIdsAdded")
  private List<String> mGeofenceIdsAdded;

  @SerializedName("LanguageCode")
  private String mLangCode;

  @SerializedName("LastUpdateTime")
  private long mLastUpdatedTime;
  private transient StoreList mStoreList;

  private void updateStores(StoreLocation paramStoreLocation)
  {
    ArrayList localArrayList;
    try
    {
      if ((this.mStoreList.getStoreRefList() != null) && (this.mStoreList.getStoreRefList().getStoreRef() != null) && (!this.mStoreList.getStoreRefList().getStoreRef().isEmpty()))
      {
        float[] arrayOfFloat = { 0.0F, 0.0F, 0.0F };
        localArrayList = new ArrayList(this.mStoreList.getStoreRefList().getStoreRef());
        if (paramStoreLocation == null)
          break label246;
        Iterator localIterator = localArrayList.iterator();
        while (localIterator.hasNext())
        {
          StoreRef localStoreRef = (StoreRef)localIterator.next();
          StoreLocation localStoreLocation = localStoreRef.getStoreLocation();
          if ((localStoreLocation != null) && (!TextUtils.isEmpty(localStoreLocation.getLat())) && (!TextUtils.isEmpty(localStoreLocation.getLong())))
          {
            Location.distanceBetween(Double.parseDouble(paramStoreLocation.getLat()), Double.parseDouble(paramStoreLocation.getLong()), Double.parseDouble(localStoreLocation.getLat()), Double.parseDouble(localStoreLocation.getLong()), arrayOfFloat);
            if ((arrayOfFloat != null) && (arrayOfFloat.length > 0))
              localStoreRef.setStoreDistance(String.valueOf(arrayOfFloat[0] / 1000.0F));
          }
        }
      }
    }
    catch (Exception localException)
    {
      L.E(this, "Error occure while update Stores : " + localException.getMessage());
      localException.printStackTrace();
    }
    return;
    Collections.sort(localArrayList, Util.mStoreComparator);
    return;
    label246: Collections.sort(localArrayList, Util.mStoreNameComparator);
  }

  public String getCountryCode()
  {
    return this.mCountryCode;
  }

  public List<String> getGeofenceIdsAdded()
  {
    return this.mGeofenceIdsAdded;
  }

  public String getGeofenceStoreId()
  {
    return this.mGeoStoreId;
  }

  public String getId()
  {
    return StoreCacheInfo.class.getSimpleName();
  }

  public String getLangCode()
  {
    return this.mLangCode;
  }

  public long getLastUpdatedTime()
  {
    return this.mLastUpdatedTime;
  }

  public StoreList getStoreList()
  {
    return this.mStoreList;
  }

  public boolean isInStore()
  {
    return this.isInStore;
  }

  public void setCountryCode(String paramString)
  {
    this.mCountryCode = paramString;
  }

  public void setGeofenceIdsAdded(List<String> paramList)
  {
    this.mGeofenceIdsAdded = paramList;
  }

  public void setGeofenceStoreId(String paramString)
  {
    this.mGeoStoreId = paramString;
  }

  public void setInStore(boolean paramBoolean)
  {
    this.isInStore = paramBoolean;
  }

  public void setLangCode(String paramString)
  {
    this.mLangCode = paramString;
  }

  public void setLastUpdatedTime(long paramLong)
  {
    this.mLastUpdatedTime = paramLong;
  }

  public void setStoreList(StoreList paramStoreList)
  {
    this.mStoreList = paramStoreList;
  }

  public void updateStoresDistance()
  {
    StoreList localStoreList = this.mStoreList;
    Object localObject = null;
    if (localStoreList != null)
    {
      StoreRefList localStoreRefList = this.mStoreList.getStoreRefList();
      localObject = null;
      if (localStoreRefList != null)
      {
        ArrayList localArrayList = new ArrayList(this.mStoreList.getStoreRefList().getStoreRef());
        localObject = null;
        if (localArrayList != null)
        {
          boolean bool = localArrayList.isEmpty();
          localObject = null;
          if (!bool)
          {
            Iterator localIterator = localArrayList.iterator();
            while (localIterator.hasNext())
            {
              StoreRef localStoreRef = (StoreRef)localIterator.next();
              if ((localStoreRef.getStoreNo() != null) && (localStoreRef.getStoreNo().equalsIgnoreCase(this.mGeoStoreId)))
                localObject = localStoreRef;
            }
          }
        }
      }
    }
    if (localObject != null)
      updateStores(localObject.getStoreLocation());
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.ikea.shared.store.service.StoreCacheInfo
 * JD-Core Version:    0.6.2
 */