
#ifndef CLIENT_HPP
# define CLIENT_HPP

# include <iostream>
# include <string>
# include <map>
# include <vector>
# include "utils.hpp"

struct Request
{
	http_method							method;
	std::string							path;
	std::string							version;
	std::map<std::string, std::string>	headers;
	std::string							body;
};

class Client
{
	public:
		Client();
		~Client();
		//Client(Client const &src);
		//Client &operator=(Client const &rhs);

		int				fd;
		std::string		raw_request;
		std::string		response;
		unsigned int	status;

		// const functions ?
		http_method		get_method();
		std::string		&get_path();
		std::string		&get_version();
		std::string		&get_body();
		std::string		&get_headers(const std::string &key);

		void	parse_request();
		void	clear();
		void	clear_request();

	private:
		struct Request	_request;

		void	_parse_request_line( std::string rline );
		void	_parse_request_headers( std::vector<std::string> list );
		void	_parse_request_body( size_t pos );

};

bool	operator==(const Client& lhs, const Client& rhs);
bool	operator==(const Client& lhs, int fd);
bool	operator==(int fd, const Client& rhs);

#endif
