<?php
/**
 * Client APi Helper
 *
 * @package WLC\Algolia
 */

namespace wlc_algolia;

use wlc_algolia\Algolia_Client;
use wlc_algolia\Algolia_Settings_Options;

/**
 * Class Client_Api_Helper
 */
class Client_Helper {
	/**
	 * Algolia Client.
	 *
	 * @var Algolia_Client $algolia_client
	 */
	protected Algolia_Client $algolia_client;

	/**
	 * Algolia Settings.
	 *
	 * @var Algolia_Settings_Options $algolia_application
	 */
	protected Algolia_Settings_Options $algolia_settings;
	/**
	 * Init Hooks.
	 *
	 * @return void
	 */
	public function __construct() {
		$this->algolia_settings = new Algolia_Settings_Options();
		$this->algolia_client   = new Algolia_Client( $this->algolia_settings );
	}

	/**
	 * Check API Credentials.
	 *
	 * @return bool
	 */
	protected function wlc_check_algolia_api_credentials(): bool {
		$application_id = $this->algolia_settings->get_application_id();
		$write_api_key  = $this->algolia_settings->get_write_api_key();
		if ( '' === $application_id || '' === $write_api_key ) {
			return false;
		}

		return true;
	}
}
