package base.interfaces;

import java.util.Map;

import base.connection.Response;

/**
 * Manages connections & requests with a server.
 */
public interface IConnection {

	/**
	 * Connects to the host with the already-defined host & port.
	 */
	public void connect();
	
	/**
	 * Connects to the given host with the default port.
	 * 
	 * @param host is the host to connect to
	 */
	public void connect(String host);

	/**
	 * Connects to the given host at the given port.
	 * 
	 * @param host is the host to connect to
	 * @param port is the host's port to connect to
	 */
	public void connect(String host, int port);
	
	/**
	 * Makes a request to this connection.
	 * 
	 * @param method defines the operation to perform (i.e. GET, DELETE, PUT, POST)
	 * @param path is the path to the resource (e.g. /john.doe/images/1)
	 * @param headers are the headers to include with the request
	 * @param params are the parameters to include with the request
	 * @param data is the body data to include with the request
	 * 
	 * @return Response represents the server's response to this request
	 */
	public Response request(String method, String path,
			Map<String, String> headers, Map<String, String> params, Object data);
}
