<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}
if ( ! class_exists( 'Draly_Dropshipping_Starter_Pluggable_One_Click_Demo_Import' ) ) {
	class Draly_Dropshipping_Starter_Pluggable_One_Click_Demo_Import {
		/**
		 * Variable to hold the initialization state.
		 *
		 * @var  boolean
		 */
		protected static $initialized = false;

		public static function initialize() {
			// Do nothing if pluggable functions already initialized.
			if ( self::$initialized ) {
				return;
			}
			add_filter( 'draly_dropshipping_starter_plugins_ocdi', array( __CLASS__, 'draly_dropshipping_starter_plugins_ocdi' ) );
			add_filter( 'ocdi/register_plugins', array( __CLASS__, 'draly_dropshipping_starter_register_plugins' ) );
			add_filter( 'villco_import_demos', array( __CLASS__, 'draly_dropshipping_starter_import_demos' ) );
			// State that initialization completed.
			self::$initialized = true;
		}

		public static function draly_dropshipping_starter_plugins_ocdi() {
			return array(
				array(
					'name'     => 'Redux Framework',
					'slug'     => 'redux-framework',
					'required' => false,
				),
				array(
					'name'     => 'Elementor Website Builder',
					'slug'     => 'elementor',
					'required' => false,
				),
				array(
					'name'     => 'WooCommerce',
					'slug'     => 'woocommerce',
					'required' => false,
				),
				array(
					'name'     => 'Contact Form 7',
					'slug'     => 'contact-form-7',
					'required' => false,
				),
				array(
					'name'     => 'ALD – Dropshipping and Fulfillment for AliExpress and WooCommerce',
					'slug'     => 'woo-alidropship',
					'required' => false,
				),
				array(
					'name'     => 'YITH WooCommerce Wishlist',
					'slug'     => 'yith-woocommerce-wishlist',
					'required' => false,
				),
				array(
					'name'     => 'YITH WooCommerce Quick View',
					'slug'     => 'yith-woocommerce-quick-view',
					'required' => false,
				),
				array(
					'name'     => 'COMPE - WooCommerce Compare Products',
					'slug'     => 'compe-woo-compare-products',
					'required' => false,
				),
				array(
					'name'     => 'Classic Widgets',
					'slug'     => 'classic-widgets',
					'required' => false,
				),
			);
		}

		public static function draly_dropshipping_starter_import_demos() {
			$demos = [
				[
					'import_file_name' => esc_html__( 'Pet Shop', 'draly-dropshipping-starter' ),
					'demo_path'        => 'https://raw.githubusercontent.com/developer240292/import/main/draly-free/demo-01/',
					'demo_uri'         => trailingslashit( get_template_directory_uri() ) . 'assets/images/import/demo-01/',
					'option_name'      => 'villco',
					'categories'       => [
						esc_html__( 'Pet', 'draly-dropshipping-starter' )
					],
					'preview_url'      => esc_url( 'https://draly0.new2new.com/' ),
				],
			];

			return $demos;
		}

		public static function draly_dropshipping_starter_register_plugins() {
			return apply_filters( 'draly_dropshipping_starter_plugins_ocdi', [] );
		}
	}
}