/*
 * Copyright (c) 2010-2022 Belledonne Communications SARL.
 *
 * This file is part of Liblinphone 
 * (see https://gitlab.linphone.org/BC/public/liblinphone).
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _MSC_VER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif // _MSC_VER

#ifndef _REMOTE_CONTACT_DIRECTORY_HH
#define _REMOTE_CONTACT_DIRECTORY_HH

#include <string>
#include "remote_contact_directory.hh"
#include "object.hh"




struct _LinphoneRemoteContactDirectory;


namespace linphone {

	class CardDavParams;
	class LdapParams;

	/**
	 * @brief Object that represents a remote contact directory such as a LDAP or
	 * CardDAV server; used as a @ref MagicSearch source. 
	 *
	 */
	class RemoteContactDirectory: public Object {
	
		public:
			/**
			* Enum describing the type of #RemoteContactDirectory (currently CardDAV or
			* LDAP). 
			*
			*/
			enum class Type {
				/**
				* Remote contact directory will use #CardDavParams. 
				*/
				CardDav = 0,
				/**
				* Remote contact directory will use #LdapParams. 
				*/
				Ldap = 1
			};


			LINPHONECXX_PUBLIC RemoteContactDirectory(void *ptr, bool takeRef=true);
			LINPHONECXX_PUBLIC _LinphoneRemoteContactDirectory *cPtr() {return (_LinphoneRemoteContactDirectory *)mPrivPtr;}

	
		public:
			
		
			/**
			 * @brief Gets the CardDAV remote contact directory if getType() returns CardDAV. 
			 *
			 * @return the @ref CardDavParams or nullptr if not of CardDAV type.    
			 */
			LINPHONECXX_PUBLIC std::shared_ptr<linphone::CardDavParams> getCardDavParams();
			
			/**
			 * @brief Gets the LDAP remote_contact_directory if getType() returns LDAP. 
			 *
			 * @return the @ref LdapParams or nullptr if not of LDAP type.    
			 */
			LINPHONECXX_PUBLIC std::shared_ptr<linphone::LdapParams> getLdapParams();
			
			/**
			 * @brief Gets the maximum number of results to fetch, 0 means no limit. 
			 *
			 * @return the maximum number of results, 0 means no limit. 
			 */
			LINPHONECXX_PUBLIC unsigned int getLimit() const;
			
			/**
			 * @brief Sets the maximum number of results to fetch, 0 means no limit. 
			 *
			 * @param limit the maximum number of results to return. 
			 */
			LINPHONECXX_PUBLIC void setLimit(unsigned int limit);
			
			/**
			 * @brief Gets the minimum number of characters to have before sending the query
			 * to the server. 
			 *
			 * @return The mininum number of characters to have before sending the query. 
			 */
			LINPHONECXX_PUBLIC unsigned int getMinCharacters() const;
			
			/**
			 * @brief Sets the minimum number of characters to have before sending the query
			 * to the server. 
			 *
			 * @param min the minimum characters to have in user input filter before sending
			 * the query. 
			 */
			LINPHONECXX_PUBLIC void setMinCharacters(unsigned int min);
			
			/**
			 * @brief Gets the configured remote contact directory server URL. 
			 *
			 * @return the remote contact directory server URL.    
			 */
			LINPHONECXX_PUBLIC std::string getServerUrl() const;
			
			/**
			 * @brief Sets the server URL to use to reach the remote contact directory server. 
			 *
			 * @param serverUrl the remote contact directory server URL.    
			 */
			LINPHONECXX_PUBLIC void setServerUrl(const std::string & serverUrl);
			
			/**
			 * @brief Gets the timeout (in seconds) after which the query is abandonned. 
			 *
			 * @return The timeout (in seconds) after which the query is considered to be
			 * timed-out. 
			 */
			LINPHONECXX_PUBLIC unsigned int getTimeout() const;
			
			/**
			 * @brief Sets the timeout (in seconds) after which the query is abandonned. 
			 *
			 * @param seconds the number of seconds before considering the query as timed-out. 
			 */
			LINPHONECXX_PUBLIC void setTimeout(unsigned int seconds);
			
			/**
			 * @brief Gets the type of remote contact directory (LDAP, CardDAV). 
			 *
			 * @return the @ref Type of this remote contact directory. 
			 */
			LINPHONECXX_PUBLIC Type getType() const;
			
			
	};

};

#endif // _REMOTE_CONTACT_DIRECTORY_HH

#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif // _MSC_VER
