<?php
/**
 * The file contains plugin initialization
 *
 * Plugin Name: WLC Search Integration with Algolia
 * Description: Integrates WordPress search with the Algolia service — autocomplete, search pages, and faceted filtering. Not affiliated with or endorsed by Algolia.
 * Version: 1.0.1
 * Author: White Label Coders
 * License: GPL v2 or later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: wlc-search-integration-with-algolia
 * Requires at least: 5.9
 * Requires PHP: 8.1
 *
 * @category Plugin file
 * @package WLC\Algolia
 * @author WLC Team
 * @license GPL-2.0-or-later
 * @link https://whitelabelcoders.com/
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

if ( ! defined( 'WLC_ALGOLIA_PLUGIN_FILE' ) ) {
	define( 'WLC_ALGOLIA_PLUGIN_FILE', __FILE__ );
}

if ( ! defined( 'WLC_ALGOLIA_PLUGIN_DIR_PATH' ) ) {
	define( 'WLC_ALGOLIA_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) );
}

if ( ! defined( 'WLC_ALGOLIA_PLUGIN_DIR_URL' ) ) {
	define( 'WLC_ALGOLIA_PLUGIN_DIR_URL', plugin_dir_url( __FILE__ ) );
}

if ( ! defined( 'WLC_ALGOLIA_PLUGIN_CURRENT_VERSION' ) ) {
	define( 'WLC_ALGOLIA_PLUGIN_CURRENT_VERSION', '1.0.1' );
}

// Include the main WLC Algolia class.
if ( ! class_exists( 'WLC_Algolia', false ) ) {
	require_once WLC_ALGOLIA_PLUGIN_DIR_PATH . 'includes/classes/class-wlc-algolia.php';
}

// include Composer autoloader.
require __DIR__ . '/vendor/autoload.php';

add_action(
	'plugins_loaded',
	static function () {
		wlc_algolia\WLC_Algolia::instance();
	}
);
