package bank;

// Una cuenta protege su invariante; Money es un valor inmutable.
public class BankDemo {
    public static void main(String[] args) {
        BankAccount alice = new BankAccount("Alice");
        BankAccount bob = new BankAccount("Bob");
        alice.deposit(10_000);
        boolean ok = alice.withdraw(2_500);
        IO.println(alice.id() + " " + alice.owner() + ": retiro " + ok + ", saldo " + alice.balance());
        ok = bob.withdraw(2_500);
        IO.println(bob.id() + " " + bob.owner() + ": retiro " + ok + ", saldo " + bob.balance());
        IO.println("cuentas abiertas: " + BankAccount.accountsOpened());

        Money price = Money.soles(1_050);
        Money total = price.plus(Money.soles(250));
        IO.println(price + " + S/ 2.50 = " + total);
        IO.println("iguales: " + total.equals(new Money(1_300, "PEN")));
    }
}
