package com.mybank.domain;

import java.util.ArrayList;
import java.util.List;

public class Customer {

	private String firstName;
	private String lastName;
	private Account account;
	// add an array of accounts and numOfAccounts
//	private Account[] accounts;
	private int numOfAccounts;
	private List<Account> accounts;

	public Customer(String f, String l) {
		firstName = f;
		lastName = l;
		// initialize array accounts and numOfAccounts
//		accounts = new Account[5];
		numOfAccounts = 0;
		accounts = new ArrayList<Account>();
	}

	public String getFirstName() {
		return firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public Account getAccount() {
		return account;
	}

	public void setAccount(Account acct) {
		account = acct;
	}

	public void addAccount(Account acct) {
//		accounts[numOfAccounts++] = acct;
		accounts.add(acct);
		numOfAccounts++;
	}

	public Account getAccount(int index) {
		if (index >= 0) {
			if (accounts.get(index) != null) {
				return accounts.get(index);
			}
//			if (accounts[index] != null) {
//				return accounts[index];
//			}
		}
		return null;
	}

	public int getNumOfAccounts() {
		return numOfAccounts;
	}
}
