package tv.ouya.console.api;

import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Currency;
import org.json.JSONException;
import org.json.JSONObject;

public class Product
  implements Parcelable
{
  public static final Parcelable.Creator<Product> CREATOR = new Parcelable.Creator()
  {
    public Product createFromParcel(Parcel paramAnonymousParcel)
    {
      return new Product(paramAnonymousParcel.readString(), paramAnonymousParcel.readString(), paramAnonymousParcel.readInt(), paramAnonymousParcel.readDouble(), paramAnonymousParcel.readString(), paramAnonymousParcel.readDouble(), paramAnonymousParcel.readDouble(), paramAnonymousParcel.readString());
    }
    
    public Product[] newArray(int paramAnonymousInt)
    {
      return new Product[paramAnonymousInt];
    }
  };
  public static final int CURRENT_PRODUCT_VERSION = 4;
  public static final int INITIAL_PRODUCT_VERSION = 1;
  private String currencyCode;
  private String description;
  private String identifier;
  private double localPrice;
  private String name;
  private double originalPrice;
  private double percentOff;
  private int priceInCents;
  private int productVersionToBundle = 4;
  
  public Product() {}
  
  public Product(String paramString1, String paramString2, int paramInt, double paramDouble1, String paramString3, double paramDouble2, double paramDouble3, String paramString4)
  {
    this.identifier = paramString1;
    this.name = paramString2;
    this.priceInCents = paramInt;
    this.localPrice = paramDouble1;
    this.currencyCode = paramString3;
    this.originalPrice = paramDouble2;
    this.percentOff = paramDouble3;
    this.description = paramString4;
  }
  
  public Product(JSONObject paramJSONObject)
    throws JSONException
  {
    readFromJSONObject(paramJSONObject);
  }
  
  public int describeContents()
  {
    return 0;
  }
  
  public boolean equals(Object paramObject)
  {
    if (this == paramObject) {}
    do
    {
      return true;
      if (!(paramObject instanceof Product)) {
        return false;
      }
      paramObject = (Product)paramObject;
      if (this.priceInCents != ((Product)paramObject).priceInCents) {
        return false;
      }
      if (!this.name.equals(((Product)paramObject).name)) {
        return false;
      }
      if (!this.identifier.equals(((Product)paramObject).identifier)) {
        return false;
      }
      if (this.localPrice != ((Product)paramObject).localPrice) {
        return false;
      }
      if ((this.currencyCode != null) && (!this.currencyCode.equals(((Product)paramObject).currencyCode))) {
        return false;
      }
      if (this.originalPrice != ((Product)paramObject).originalPrice) {
        return false;
      }
      if (this.percentOff != ((Product)paramObject).percentOff) {
        return false;
      }
    } while (this.description == ((Product)paramObject).description);
    return false;
  }
  
  public String getCurrencyCode()
  {
    return this.currencyCode;
  }
  
  public String getDescription()
  {
    return this.description;
  }
  
  public String getFormattedPrice()
  {
    DecimalFormat localDecimalFormat;
    if ((this.currencyCode != null) && (!this.currencyCode.isEmpty()))
    {
      localDecimalFormat = (DecimalFormat)NumberFormat.getCurrencyInstance();
      localDecimalFormat.setCurrency(Currency.getInstance(this.currencyCode));
    }
    for (;;)
    {
      return localDecimalFormat.format(this.localPrice);
      localDecimalFormat = new DecimalFormat("#.00");
    }
  }
  
  public String getIdentifier()
  {
    return this.identifier;
  }
  
  public double getLocalPrice()
  {
    return this.localPrice;
  }
  
  public String getName()
  {
    return this.name;
  }
  
  public double getOriginalPrice()
  {
    return this.originalPrice;
  }
  
  public double getPercentOff()
  {
    return this.percentOff;
  }
  
  @Deprecated
  public int getPriceInCents()
  {
    return this.priceInCents;
  }
  
  public int hashCode()
  {
    int j = ((this.identifier.hashCode() * 31 + this.name.hashCode()) * 31 + this.priceInCents) * 31 + new Double(this.localPrice).hashCode();
    int i = j;
    if (this.currencyCode != null) {
      i = j * 31 + this.currencyCode.hashCode();
    }
    return i;
  }
  
  public void readFromJSONObject(JSONObject paramJSONObject)
    throws JSONException
  {
    this.identifier = paramJSONObject.getString("identifier");
    this.name = paramJSONObject.getString("name");
    this.priceInCents = paramJSONObject.optInt("priceInCents");
    this.localPrice = paramJSONObject.optDouble("localPrice");
    this.currencyCode = paramJSONObject.optString("currency", null);
    this.originalPrice = paramJSONObject.optDouble("originalPrice");
    this.percentOff = paramJSONObject.optDouble("percentOff");
    this.description = paramJSONObject.optString("description", "");
  }
  
  public void setCurrencyCode(String paramString)
  {
    this.currencyCode = paramString;
  }
  
  public void setProductVersionToBundle(int paramInt)
  {
    this.productVersionToBundle = paramInt;
  }
  
  public void writeToParcel(Parcel paramParcel, int paramInt)
  {
    paramParcel.writeString(this.identifier);
    paramParcel.writeString(this.name);
    paramParcel.writeInt(this.priceInCents);
    if (this.productVersionToBundle >= 2)
    {
      paramParcel.writeDouble(this.localPrice);
      paramParcel.writeString(this.currencyCode);
    }
    if (this.productVersionToBundle >= 3)
    {
      paramParcel.writeDouble(this.originalPrice);
      paramParcel.writeDouble(this.percentOff);
    }
    if (this.productVersionToBundle >= 4) {
      paramParcel.writeString(this.description);
    }
  }
}


/* Location:              /home/enzo/Documents/hacking/malwares/viking-horde/classes.jar!/tv/ouya/console/api/Product.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */