package com.mybank.data;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

import com.mybank.domain.Bank;
import com.mybank.domain.Customer;

public class DataSource {

	private File dataFile;

	public DataSource(String dataFilePath) {
		dataFile = new File(dataFilePath);
	}

	public void loadData() throws IOException {
		// prepare to read data file
		Scanner input = new Scanner(dataFile);

		Customer customer;

		// start reading data
		// get number of customers
		int numOfCustomers = input.nextInt();

		// loop each customer
		for (int index = 0; index < numOfCustomers; index++) {
			// read customer first and last name
			String firstName = input.next();
			String lastName = input.next();
			
			// get number of accounts for each customer
			int numOfAccounts = input.nextInt();
			
			// add customer to bank
			Bank.addCustomer(firstName, lastName);
			
			// get customer from back
			customer = Bank.getCustomer(index);
			
			// create customer accounts
			while(numOfAccounts-- > 0) {
				
			}
		}
	}
}
