package com.andrewlalis.perfin.model;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Currency;

/**
 * A recording of an account's real reported balance at a given point in time.
 */
public class BalanceRecord extends IdEntity implements Timestamped {
    private final LocalDateTime timestamp;
    private final long accountId;
    private final BalanceRecordType type;
    private final BigDecimal balance;
    private final Currency currency;

    public BalanceRecord(long id, LocalDateTime timestamp, long accountId, BalanceRecordType type, BigDecimal balance, Currency currency) {
        super(id);
        this.timestamp = timestamp;
        this.accountId = accountId;
        this.type = type;
        this.balance = balance;
        this.currency = currency;
    }

    public LocalDateTime getTimestamp() {
        return timestamp;
    }

    public long getAccountId() {
        return accountId;
    }

    public BalanceRecordType getType() {
        return type;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public Currency getCurrency() {
        return currency;
    }

    public MoneyValue getMoneyAmount() {
        return new MoneyValue(balance, currency);
    }
}
