/*********
*****************************************************************************************

  Author: Jared Hopf



*****************************************************************************************
  **********/

#ifndef PERSON_H
#define PERSON_H

// System includes

#include <cstring>
#include <iostream>
#include <fstream>

using namespace std;

#define NAME_SIZE 256
#define PHONE_SIZE 32
#define COUNTRY_SIZE 64
#define PROVINCE_SIZE 16

typedef class person* personPTR;

enum personField 
{
	FIRST,
	LAST,
	ADDRESS,
	CITY,
	PROVINCE,
	POSTAL,
	COUNTRY,
	PHONE_HOME,
	PHONE_CELL,
	EMAIL,
	END_FIELD
};

static char fieldNames[10][80] = {
	"First Name.",
	"Last Name.",
	"Address.",
	"City.",
	"Province.",
	"Postal Code.",
	"Country.",
	"Phone (Hone).",
	"Phone (Cell).",
	"E-Mail." 
};


class person
{

public:
	person();

	bool operator ==(const person& EQ);
	bool operator <(const person& LT);
	bool operator >(const person& GT);
	bool operator <=(const person& LTE);
	bool operator >=(const person& GTE);
	bool operator !=(const person& NE);

	void blankPerson();
	void displayPerson();
	void inputPerson();
	void inputPerson(ifstream &in);
	void writePerson(ofstream &out);
	int checkField(char *buffer, personField field);

	inline void setFirstName(char *FN) { memcpy( firstName, FN, sizeof (char) * NAME_SIZE); }
	inline void setLastName(char *LN) { memcpy( lastName, LN, sizeof (char) * NAME_SIZE); }
	inline void setAddress(char *A) { memcpy( address, A, sizeof (char) * NAME_SIZE); }
	inline void setCity(char *C) { memcpy( city, C, sizeof (char) * NAME_SIZE); }
	inline void setProvince(char *P) { memcpy( province, P, sizeof (char) * PROVINCE_SIZE); }
	inline void setPostalCode(char *PC) { memcpy( postalCode, PC, sizeof (char) * PROVINCE_SIZE); }
	inline void setCountry(char *C) { memcpy( country, C, sizeof (char) * COUNTRY_SIZE); }
	inline void setPhoneHome(char *PH) { memcpy( phoneHome, PH, sizeof (char) * PHONE_SIZE); }
	inline void setPhoneCell(char *PC) { memcpy( phoneCell, PC, sizeof (char) * PHONE_SIZE); }
	inline void setEmail(char *E) { memcpy( email, E, sizeof (char) * NAME_SIZE); }

	inline char* getFirstName() { 
		char* FN = new char[NAME_SIZE];
		memcpy( FN, firstName, sizeof (char) * NAME_SIZE); 
		return(FN);
	}

	inline char* getLastName() { 
		char* LN = new char[NAME_SIZE];
		memcpy( LN, lastName, sizeof (char) * NAME_SIZE); 
		return(LN);
	}

	inline char* getAddress() { 
		char* A = new char[NAME_SIZE];
		memcpy( A, address, sizeof (char) * NAME_SIZE); 
		return(A);
	}
	
	inline char* getCity() { 
		char* C = new char[NAME_SIZE];
		memcpy( C, city, sizeof (char) * NAME_SIZE); 
		return(C);
	}

	inline char* getProvince() { 
		char* P = new char[NAME_SIZE];
		memcpy( P, province, sizeof (char) * PROVINCE_SIZE); 
		return(P);
	}

	inline char* getPostalCode() { 
		char* PC = new char[PROVINCE_SIZE];
		memcpy( PC, postalCode, sizeof (char) * PROVINCE_SIZE); 
		return(PC);
	}

	inline char* getCountry() {
		char* C = new char[COUNTRY_SIZE];
		memcpy( C, country, sizeof (char) * COUNTRY_SIZE); 
		return(C);
	}

	inline char* getPhoneHome() { 
		char* PH = new char[PHONE_SIZE];
		memcpy( PH, phoneHome, sizeof (char) * PHONE_SIZE);
		return(PH);
	}

	inline char* getPhoneCell() { 
		char* PC = new char[PHONE_SIZE];
		memcpy( PC, phoneCell, sizeof (char) * PHONE_SIZE); 
		return(PC);
	}
	
	inline char* getEmail() { 
		char* E = new char[NAME_SIZE];
		memcpy( E, email, sizeof (char) * NAME_SIZE); 
		return(E);
	}

protected:

	char firstName [NAME_SIZE];
	char lastName [NAME_SIZE];
	char address [NAME_SIZE];
	char city [NAME_SIZE];
	char province [PROVINCE_SIZE];
	char postalCode [PROVINCE_SIZE];
	char country [COUNTRY_SIZE];
	char phoneHome [PHONE_SIZE];
	char phoneCell [PHONE_SIZE];
	char email[NAME_SIZE];


private:


};



#endif