#include <ios>
#include <ostream>
#include <sstream>
#include <string>
#include <iostream>
#include <iomanip>
#include "../include/Contact.hpp"
#include "../include/utils.hpp"

Contact::Contact(std::string first_name, std::string last_name, std::string nickname, std::string phone_number, std::string darkest_secret)
{
	this->first_name = std::string(first_name);
	this->last_name = std::string(last_name);
	this->nickname = std::string(nickname);
	this->phone_number = std::string(phone_number);
	this->darkest_secret = std::string(darkest_secret);
}

std::string Contact::to_string_partial() const
{
	std::stringstream	ss;
	std::string			short_first_name;
	std::string			short_last_name;
	std::string			short_nickname;
	std::string			short_phone_number;
	std::string			short_darkest_secret;

	short_first_name = truncated(this->first_name);
	short_last_name = truncated(this->last_name);
	short_nickname = truncated(this->nickname);
	short_phone_number = truncated(this->phone_number);
	short_darkest_secret = truncated(this->darkest_secret);

	ss << std::setw(10) << short_first_name << "|"
		<< std::setw(10) << short_last_name << "|"
		<< std::setw(10) << short_nickname << "|"
		<< std::setw(10) << short_phone_number << "|"
		<< std::setw(10) << short_darkest_secret;

	return(ss.str());
}

std::string Contact::to_string_complete() const
{
	std::stringstream	ss;

	ss << std::setw(10) << this->first_name << "|"
		<< std::setw(10) << this->last_name << "|"
		<< std::setw(10) << this->nickname << "|"
		<< std::setw(10) << this->phone_number << "|"
		<< std::setw(10) << this->darkest_secret << "|";

	return(ss.str());
}
