<?php

namespace XIMSAPLUGIN\Element;


class Elementor {
	static $widgets = array(
		//Home Page One
		'our_services',
		'about_us',
		'have_any_project',
		'popular_services',
		'funfacts',
		'subscribe_form',
		'our_testimonials',
		'latest_news',
		'call_to_action',
		
		//Home Page Two
		'rev_slider',
		'who_we_are',
		'our_services_v2',
		'about_us_v2',
		'our_projects',
		'digital_marketing',
		'our_clients',
		'pricing_plan',
		'our_testimonials_v2',
		'latest_news_v2',
		
		//Home Page Three
		'our_banner',
		'feature_app',
		'our_services_v3',
		'screen_customizable',
		'working_process',
		'market_app',
		'apps_screnshots',
		'pricing_plan_v2',
		'our_testimonials_v3',
		'download_app',
		
		//Home Page Four
		'popular_features',
		'popular_business',
		'funfacts_v2',
		'feature_tabs',
		'marketing_analysis',
		'pricing_plan_v3',
		'our_faqs',
		'subscribe_form_v2',
		'our_testimonials_v4',
		
		//Home Page Payment
		'banking_banner',
		'banking_feature',
		'banking_fanfact',
		'banking_feature_content',
		'banking_feature_content_v2',
		'banking_testimonial',
		'banking_clients',
		'banking_contact_info',
		'banking_footer',

		//Home Digital Agency
		'dgi_about_widget',
		'dgi_banner_widget',
		'dgi_service_widget',
		'dgi_skill_widget',
		'dgi_team_widget',
		'dgi_testimonials_widget',
		'dgi_footer',
		
		// Crypto Home
		'cripto_banner_widget',
		'cripto_coin_widget',
		'crypto_app_section_widget',
		'crypto_client_widget',
		'crypto_market_widget',
		'crypto_reward_widget',
		'crypto_testimonial_widget',
		'crypto_blog_section',
		'crypto_footer',

		// Digital Payment 
		'digpay_app_info',
		'digpay_features_sec',
		'digpay_discount_section',
		'digpay_card_section',
		'digpay_testimonials',
		'digpay_sponsor',
		'digpay_steps_section',
		'digpay_footer',

		// Digital Marketing Home
		'digm_slider',
		'digm_fanfact',
		'digm_service',
		'digm_step_section',
		'digm_sponcor',
		'digm_intregration_section',
		'digm_pricing_table',
		'digm_cta_section',
		'digm_company',
		'digm_app_download',
		'digm_footer',

		// Saas Home
		'saas_banner',
		'saas_sponcor',
		'saas_about',
		'saas_steps',
		'saas_features',
		'saas_feature_v2',
		'saas_service',
		'saas_testimonial',
		'saas_blog',
		'saas_help',
		'saas_cta',
		'saas_footer',

		// Fintech Home
		'fintech_banner',
		'fintech_rewards',
		'fintech_features',
		'fintech_product',
		'fintech_crypto_info',
		'fintech_sponsor',
		'fintech_testimonial',
		'fintech_fanfact',
		'fintech_subscribe',
		'fintech_payment',
		'fintech_footer',
		
		// NFT Home
		'nft_banner',
		'nft_market',
		'nft_top_seller',
		'nft_product',
		'nft_sell_create',
		'nft_live_auction',
		'nft_team',
		'nft_newslater',
		'nft_footer',

		// IT Home
		'it_footer_widget',
		'it_post_widget',
		'it_section_title',
		'it_testimonials',
		'it_portfolio',
		'it_fanfact',
		'it_pricing_table',
		'it_clients',
		'it_about',
		'it_features_content',
		'it_service',
		'it_feature_v2',
		'it_instagram',

		// insurance Home
		'insurance_cta',
		'insurance_appoinment',
		'insurance_about',
		'insurance_clients',
		'insurance_intro',
		'intro_section_v2',
		'insurance_project',
		'insurance_testimonial',
		'insurance_fnf',
		'insurence_company',
		'insurance_plan',
		'insurance_pricing_table',
		'insurance_agent',
		'insurance_blog',
		'insurance_footer',

		// live chat
		'livechat_hero',
		'livechat_clients',
		'livechat_collaboration',
		'livechat_remot',
		'livechat_response_section',
		'livechat_service',
		'livechat_blog',
		'livechat_cta',
		'livechat_testimonial',
		'livechat_chat',
		'livechat_cost',
		'livechat_portfolio',
		'livechat_footer',

		// IT SOlution V2
		'it_v2_hero_section',
		'it_v2_about',
		'it_v2_scroll_section',
		'it_v2_skills',
		'it_v2_service',
		'it_v2_portfolio',
		'it_v2_team',
		'it_v2_testimonial',
		'ti_v2_sponcore',
		'it_v2_blog',
		'it_v2_footer',

		// Helpdesk 
		'helpdesk_banner',
		'helpdesk_features',
		'helpdesk_testimonial',
		'helpdesk_footer',
		'helpdesk_fanfact',
		'helpdesk_newslater',
		'helpdesk_about',
		'helpdesk_pricing_table',

		//Inner Pages
		'funfacts_v3',
		'our_team',
		'our_skills',
		'our_faqs_v2',
		'our_faqs_v3',
		'pricing_plan_v4',
		'what_we_offer',
		'service_detail',
		'project_grid_view',
		'project_masonry',
		'project_details',
		'contact_info',
		'google_map',
		'contact_us',
		'mega_menu',
		'mega_menu_list',
	);

	static function init() {
		add_action( 'elementor/init', array( __CLASS__, 'loader' ) );
		add_action( 'elementor/elements/categories_registered', array( __CLASS__, 'register_cats' ) );
	}

	static function loader() {

		foreach ( self::$widgets as $widget ) {

			$file = XIMSAPLUGIN_PLUGIN_PATH . '/elementor/' . $widget . '.php';
			if ( file_exists( $file ) ) {
				require_once $file;
			}

			add_action( 'elementor/widgets/widgets_registered', array( __CLASS__, 'register' ) );
		}
	}

	static function register( $elemntor ) {
		foreach ( self::$widgets as $widget ) {
			$class = '\\XIMSAPLUGIN\\Element\\' . ucwords( $widget );

			if ( class_exists( $class ) ) {
				$elemntor->register_widget_type( new $class );
			}
		}
	}

	static function register_cats( $elements_manager ) {

		$elements_manager->add_category(
			'ximsa',
			[
				'title' => esc_html__( 'Ximsa', 'ximsa' ),
				'icon'  => 'fa fa-plug',
			]
		);
		$elements_manager->add_category(
			'templatepath',
			[
				'title' => esc_html__( 'Template Path', 'ximsa' ),
				'icon'  => 'fa fa-plug',
			]
		);

	}
}

Elementor::init();