package foundation.omni.rpc;

import org.bitcoinj.core.Address;

import java.math.BigDecimal;

/**
 * Balance data for a specific Omni CurrencyID in a single Bitcoin address
 *
 * A Java representation of the JSON entry returned by getallbalancesforid_MP
 */
public class MPBalanceEntry {
    private Address address;
    private BigDecimal balance;
    private BigDecimal reserved;

    public MPBalanceEntry(Address address, BigDecimal balance, BigDecimal reserved) {
        this.address = address;
        this.balance = balance;
        this.reserved = reserved;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MPBalanceEntry that = (MPBalanceEntry) o;

        if (!address.equals(that.address)) return false;
        if (!balance.equals(that.balance)) return false;
        if (!reserved.equals(that.reserved)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = address.hashCode();
        result = 31 * result + balance.hashCode();
        result = 31 * result + reserved.hashCode();
        return result;
    }

    public Address getAddress() {
        return address;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public BigDecimal getReserved() {
        return reserved;
    }
}

@@ -848,17 +848,16 @@
 if (
-!
 balance.
 equa
@@ -852,22 +852,25 @@
 balance.
-equals
+compareTo
 (that.ba
@@ -875,16 +875,21 @@
 balance)
+ != 0
 ) return
@@ -908,17 +908,16 @@
     if (
-!
 reserved
@@ -917,22 +917,25 @@
 eserved.
-equals
+compareTo
 (that.re
@@ -941,16 +941,21 @@
 eserved)
+ != 0
 ) return

Fix balance comparison