#include "addressbook.h"

int main() {
	Person* moi;
	PhoneNumber* fixe;
	PhoneNumber* portable;
	PhoneNumber* recupphone;	


	fixe = malloc(sizeof(PhoneNumber));
	portable = malloc(sizeof(PhoneNumber));
	recupphone=malloc(sizeof(PhoneNumber));

	char* numfixe = malloc(10*sizeof(char));
	char* numportable = malloc(10*sizeof(char));
	strcpy( numfixe, "0130535773");
	strcpy( numportable , "0626104189");	
	
	PhoneNumber_setNumber(fixe, numfixe);
	PhoneNumber_setNumber(portable, numportable);

	char* email = malloc(40*sizeof(char));
	char* nom = malloc(40*sizeof(char));

	moi = malloc(sizeof(Person));
	
	strcpy(email,"daniel.jartoux@isae.fr");
	strcpy(nom,"Daniel Jartoux");
	Person_setName(moi,nom);
	Person_setId(moi, 1);
	Person_setEmail(moi, email);
	Person_setPhoneSize(moi, 2);
	Person_setPhone(moi, *fixe, 1);
	Person_setPhone(moi, *portable, 2);


	*recupphone=Person_getPhone(moi, 1);
	
	printf("nom : %s\n", Person_getName(*moi));
	printf("id : %d\n", Person_getId(*moi));
	printf("mail : %s\n", Person_getEmail(*moi));
	printf("numero fixe : %s\n", PhoneNumber_getNumber(*recupphone));

	*recupphone=Person_getPhone(moi, 2);
	
	printf("numero portable : %s\n", PhoneNumber_getNumber(*recupphone));
	return 1;
}

