/**
 * Implementation of interface Contact
 * @author BBK-PiJ-2015-74 lburge01
 */

package impl;

import java.util.ArrayList;
import java.util.Objects;

import spec.Contact;
import java.io.Serializable;

public class ContactImpl implements Contact, Serializable {
	
	/**
	 * Chose to use a list to hold the added notes so this can be easily updated and output
	 * contactNotes is initialised as an Array List using the Java Collections Array List interface 
	 * Otherwise we just have to make a longer string every time and it's difficult to track updates
	 * Successive notes will be added to an array list
	 */
	private int contactId;
	private String contactName;
	private ArrayList<String> contactNotes;

	/**
	 * This constructor creates a new Contact without notes
	 * Another, more restricted constructor must have two parameters only: ID and name
	 * if the ID provided is zero or negative, an IllegalArgumentException must be thrown
	 * If any of the references provided/ pointers passed as parameters to the constructors is null, 
	 * a NullPointerException must be thrown.
	 * @param id, the ID provided by the Contact Manager
	 * @param name, the name of the Contact
	 */
	public ContactImpl(int id, String name) {
		
		if (id <= 0) {
			throw new IllegalArgumentException ("Error in contact: contact ID must not be zero or negative");
		}
		
		if (name.equals("")) {
			throw new IllegalArgumentException ("Error in contact: name cannot be empty" + "for contactId :" + id);
		}
		
		this.contactId = Objects.requireNonNull(id);
		this.contactName = Objects.requireNonNull(name);
		this.contactNotes = new ArrayList<String>(); 
	}
	
	/**
	 * This constructor creates a new Contact with notes
	 * The most general constructor must have three parameters: int, String, String
	 * The first one corresponds to the ID provided by the ContactManager, the next one corresponds to the name,
	 * and the last one corresponds to the initial set of notes about the contact
	 * @param id, the ID provided by the Contact Manager
	 * @param name, the name of the contact
	 * @param notes, the initial set of notes about the contact
	 */
	public ContactImpl(int id, String name, String notes) {
		
		this (id, name); // this passes the parameters from the first constructor through to the second
		addNotes(notes); 
	}
	

	@Override
	public int getId() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String getName() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getNotes() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void addNotes(String note) {
		// TODO Auto-generated method stub

	}

}

@@ -1583,29 +1583,24 @@
 ll(name);%0A%09%09
-this.
 contactNotes
@@ -2306,16 +2306,50 @@
 ; %0A%09%7D%0A%09%0A
+%09/**%0A%09 * @see Contact#getId()%0A%09 */
 %0A%09@Overr
@@ -2380,333 +2380,566 @@
 %7B%0A%09%09
-// TODO Auto-generated method stub%0A%09%09return 0;%0A%09%7D%0A%0A%09@Override%0A%09public String getName() %7B%0A%09%09// TODO Auto-generated method stub%0A%09%09return null;%0A%09%7D%0A%0A%09@Override%0A%09public String getNotes() %7B%0A%09%09// TODO Auto-generated method stub%0A%09%09return null;%0A%09%7D%0A%0A%09@Override%0A%09public void addNotes(String note) %7B%0A%09%09// TODO Auto-generated method stub%0A
+return contactId;%0A%09%7D%0A%0A%09/**%0A%09 * @see Contact#getName()%0A%09 */%0A%09@Override%0A%09public String getName() %7B%0A%09%09return contactName;%0A%09%7D%0A%0A%09/**%0A%09 * @see Contact#getNotes()%0A%09 */%0A%09@Override%0A%09public String getNotes() %7B%0A%09%09return contactNotes; // type mismatch - cannot convert from ArrayList%3CString%3E to String - what to do??%0A%09%7D%0A%0A%09@Override%0A%09public void addNotes(String note) %7B%0A%09%09Objects.requireNonNull(note);%0A%09%09if (note.equals(%22%22)) %7B%0A%09%09%09throw new IllegalArgumentException (%22Error in contact: notes cannot be empty%22 + %22for contactId :%22 + contactId);%0A%09%09%7D%0A%09%09contactNotes.add(note);
 %0A%09%7D%0A

Implemented getName(), getId(), getNotes(). getNotes() has a type mismatch Implemented addNotes(note) with exceptions for null and empty notes