<?php
/**
 * This file defines all required plugin constants.
 *
 * @package object-data-sync-for-salesforce\Helper
 */

namespace MoSfSyncSalesforce\Helper;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use MoSfSyncSalesforce\Helper\Basic_Enum;


/**
 * Class Contains constants used in the plugin.
 */
class Plugin_Constants extends Basic_Enum {

	const HOSTNAME      = 'https://login.xecurify.com';
	const VERSION       = '1.3.6';
	const ACCESS_TOKEN  = 'access_token';
	const REFRESH_TOKEN = 'refresh_token';

	const MAPPING_OBJECT       = 'mo_sf_sync_object';
	const PROVISION_OBJECT     = 'mo_sf_sync_provision';
	const SF_RESPONSE_OBJECT   = 'mo_sf_sync_salesforce_response';
	const CONFIG_OBJECT        = 'mo_sf_sync_config';
	const DEMO_REQUEST_CONTENT = 'mo_sf_sync_demo_request_content';
	const TOPLEVEL_JS_SCRIPT   = array(
		'toplevel_page_mo_sf_sync',
		'object-data-sync-for-salesforce_page_mo_sf_sync_troubleshoot',
	);
	const TOPLEVEL_CSS_STYLES  = array(
		'toplevel_page_mo_sf_sync',
		'object-data-sync-for-salesforce_page_mo_sf_sync_troubleshoot',
	);

	const CLIENT_SECRET                       = 'client_secret';
	const CLIENT_ID                           = 'client_id';
	const REDIRECT_URI                        = 'redirect_uri';
	const ENVIRONMENT                         = 'env_select';
	const ENVIRONMENT_LINK                    = 'env_link';
	const AUTO_USER_UPDATE                    = 'automatic_user_update';
	const AUDIT_LOGS                          = 'mo_sf_sync_enable_audit_logs';

	const SCOPES = 'api refresh_token';

	const WPTOSF               = 'sync wp to sf';
	const SFTOWP               = 'sync sf to wp';
	const DEFAULT_DEMO_QUERY   = 'Can you please provide us demo of the premium plugin.';
	const DEMO_REQUEST_SUCCESS = 'Demo Request successful. A miniOrange representative will reach out to you on the E-mail id mentioned below.';

	const SELECTED_OBJECT = 'object_select';
	const WP_OBJECT       = 'wp_object_select';
	const CONNECTION_TYPE = 'mo_sf_sync_connection_type';
	const LAST_AUTH_TIME  = 'mo_sf_sync_last_auth_time';

	const TRANSIENT_CONFIG_OBJECT            = 'mo_sf_sync_config_transient';
	const MO_SF_SYNC_CONFIG_TRANSIENT        = '_transient_mo_sf_sync_config_transient';
	const TRANSIENT_TIMEOUT_PLUGIN_ACTIVATED = '_transient_timeout_mo_sf_sync_plugin_activated';
	const TRANSIENT_PLUGIN_ACTIVATED         = '_transient_mo_sf_sync_plugin_activated';
	const TRANSIENT_AUTHORIZATION_STATE      = '_transient_mo_sf_sync_transient_authorization_state';
	const TRANSIENT_LEAD_OBJECT              = 'transient_lead_object';
	const TRANSIENT_TRIAL_REQUEST            = 'mo_sf_sync_made_trial_request';
	const TRANSIENT_GET_OBJECT               = 'transient_get_object';
	const TRANSIENT_TRIAL_NOTICE             = 'mo_sf_sync_normal_trial_notice_dismiss_time';
	const TRANSIENT_INTEGRATION_NOTICE       = 'mo_sf_sync_integration_trial_notice_dismiss_time';

	const SUGGESTED_ADDONS = array(
		'Employee-Staff-Directory' => array(
			'title'    => 'Employee Staff Directory',
			'text'     => 'Employee Directory plugin creates a central directory of your Employees, Staff, Members, or Team and displays the listing on your WordPress site. Provides an easily searchable, sortable list of all the Employees, group or tag your Employees based on custom categories, Password protect your Employee details, and many more.',
			'link'     => 'https://wordpress.org/plugins/employee-staff-directory/',
			'knw-link' => 'https://plugins.miniorange.com/employee-directory-and-staff-listing-for-wordpress',
		),
	);

	const EXISTING_USER   = 'Existing User';
	const REMOVED_ACCOUNT = 'removed_account';

	const INTEGRATIONS_TAB_CATEGORIES = array(
		array(
			'title'   => 'Form Builder Plugins',
			'slug'    => 'form-builder',
			'plugins' => array(
				array(
					'slug'        => 'contact_form_7',
					'title'       => 'Contact Form 7',
					'description' => 'Sync any and all data forms filled by your website visitors with Salesforce. With our Contact Form 7 integration you can immediately sync data to Salesforce when a website visitor registers for an event, subscribes to a newsletter, etc.',
					'url'         => 'https://plugins.miniorange.com/salesforce-web-to-lead-form-wordpress#useCases',
				),
				array(
					'slug'        => 'ninja_forms',
					'title'       => 'Ninja Forms',
					'description' => 'Our Ninja Forms integration allows you to sync any data submitted by your users to Salesforce objects. For example, immediately create a Lead in Salesforce when someone fills out a contact form. You can also create accounts and contacts on user registration.',
					'url'         => 'https://plugins.miniorange.com/salesforce-web-to-lead-form-wordpress#useCases',
				),
				array(
					'slug'        => 'wp_forms',
					'title'       => 'WP Forms',
					'description' => 'Sync data of any form on your site—contact forms, lead magnets, webinar sign-up forms, and more—with Salesforce objects. Each form can create different objects, and fields can be mapped flexibly.',
					'url'         => 'https://plugins.miniorange.com/salesforce-web-to-lead-form-wordpress#useCases',
				),
				array(
					'slug'        => 'gravity_forms',
					'title'       => 'Gravity Forms',
					'description' => 'Connect Gravity Forms with Salesforce. Automatically add or update form submissions in Salesforce objects by integrating each form directly.',
					'url'         => 'https://plugins.miniorange.com/salesforce-web-to-lead-form-wordpress#useCases',
				),
				array(
					'slug'        => 'elementor_forms',
					'title'       => 'Elementor Forms',
					'description' => 'Seamlessly connect Elementor Forms with Salesforce. Automatically sync form submissions to Salesforce objects—create leads, contacts, or custom records directly from your Elementor-powered forms.',
					'url'         => 'https://plugins.miniorange.com/salesforce-web-to-lead-form-wordpress#useCases',
				),
			),
		),
		array(
			'title'   => 'E-commerce Plugins',
			'slug'    => 'ecommerce',
			'plugins' => array(
				array(
					'slug'        => 'woo_commerce',
					'title'       => 'Woocommerce',
					'description' => 'Keep your WooCommerce data in sync with Salesforce. Sync order data on status changes, order placement, and more. Create leads, opportunities, cases, and custom objects based on WooCommerce events.',
					'url'         => 'https://plugins.miniorange.com/woocommerce-salesforce-integration-sync-orders',
				),
				array(
					'slug'        => 'woo_subscriptions',
					'title'       => 'WooCommerce Subscriptions',
					'description' => 'Integrate WooCommerce Subscriptions with Salesforce to sync subscription events, renewals, and customer lifecycle changes. Automate recurring revenue tracking in Salesforce using subscription data.',
					'url'         => 'https://plugins.miniorange.com/woocommerce-salesforce-integration-sync-orders',
				),
			),
		),
		array(
			'title'   => 'Membership & User Management',
			'slug'    => 'membership',
			'plugins' => array(
				array(
					'slug'        => 'ultimate_member',
					'title'       => 'Ultimate Member',
					'description' => 'Create and manage user profiles in Ultimate Member using data fetched from Salesforce. Display any Salesforce data on the user profile page.',
					'url'         => 'https://plugins.miniorange.com/connect-ultimate-member-to-salesforce-in-wordpress',
				),
				array(
					'slug'        => 'paid_membership_pro',
					'title'       => 'Paid Membership Pro',
					'description' => 'Map membership levels, user credentials, and checkout data to Salesforce object fields. Keep membership data synced and maintain lifecycle data in Salesforce.',
					'url'         => 'https://plugins.miniorange.com/salesforce-paid-memberships-pro-integration',
				),
			),
		),
		array(
			'title'   => 'Custom Post Types and Fields',
			'slug'    => 'cpt-and-fields',
			'plugins' => array(
				array(
					'slug'        => 'acf',
					'title'       => 'Advance Custom Fields',
					'description' => 'Sync custom field data from ACF with Salesforce object fields. Extend your WordPress data model to Salesforce with support for various field types.',
					'url'         => 'https://plugins.miniorange.com/scheduled-automation-sync-to-wp-using-salesforce-cpt-ui-acf-integration',
				),
				array(
					'slug'        => 'cpt_ui',
					'title'       => 'Custom Post Type UI',
					'description' => 'Enable real-time, bi-directional syncing of custom post types with Salesforce. Any creation or update of CPTs in WordPress or Salesforce is mirrored in the other system.',
					'url'         => 'https://plugins.miniorange.com/scheduled-automation-sync-to-wp-using-salesforce-cpt-ui-acf-integration',
				),
			),
		),
		array(
			'title'   => 'LMS & Communities',
			'slug'    => 'lms-community',
			'plugins' => array(
				array(
					'slug'        => 'learndash',
					'title'       => 'Learndash',
					'description' => 'Sync course data and student access from LearnDash with Salesforce. Manage courses and student enrollment using Salesforce data.',
					'url'         => 'https://plugins.miniorange.com/wordpress-object-sync-for-salesforce',
				),
				array(
					'slug'        => 'buddypress',
					'title'       => 'Buddypress',
					'description' => 'Sync community data from BuddyPress with Salesforce, including user attributes like profile info, groups, and more.',
					'url'         => 'https://plugins.miniorange.com/wordpress-object-sync-for-salesforce',
				),
			),
		),
		array(
			'title'   => 'Events & Locator Plugins',
			'slug'    => 'events-location',
			'plugins' => array(
				array(
					'slug'        => 'the_events_calendar',
					'title'       => 'The Events Calendar',
					'description' => 'Sync events, venues, and organizer details between The Events Calendar and Salesforce. Manage attendees and registrations efficiently.',
					'url'         => 'https://plugins.miniorange.com/wordpress-object-sync-for-salesforce',
				),
				array(
					'slug'        => 'modern_event_calendar',
					'title'       => 'Modern Event Calendar',
					'description' => 'Sync Salesforce event details with WordPress using Modern Event Calendar. Automatically import events, manage registrations, attendees, and event info seamlessly across both platforms.',
					'url'         => 'https://www.youtube.com/watch?v=aW_Inqxc_Ms&t=198s',
				),
				array(
					'slug'        => 'wp_store_locator',
					'title'       => 'WP Store Locator',
					'description' => 'Sync store location data from Salesforce to WordPress effortlessly. Display Salesforce-managed store details on your site with interactive maps, search filters, and location-specific attributes for easy search.',
					'url'         => 'https://plugins.miniorange.com/salesforce-map-locators-sync',
				),
			),
		),
	);

	const INTEGRATIONS_TITLE = array(
		'ultimate_member'     => 'Ultimate Member',
		'paid_membership_pro' => 'Paid Membership Pro',
		'woo_commerce'        => 'Woocommerce',
		'contact_form_7'      => 'Contact Form 7',
		'ninja_forms'         => 'Ninja Forms',
		'gravity_forms'       => 'Gravity Forms',
		'wp_forms'            => 'WP Forms',
		'elementor_forms'     => 'Elementor Forms',
		'buddypress'          => 'Buddypress',
		'acf'                 => 'Advance Custom Fields',
		'cpt_ui'              => 'Custom Post Type UI',
		'wp_store_locator'    => 'WP Store Locator',
		'modern_events'       => 'Modern Event Calendar',
		'the_events_calendar' => 'The Events Calendar',
		'learndash'           => 'Learndash',
		'woo_subscriptions'   => 'WooCommerce Subscriptions',
	);

	const INTEGRATIONS_ADVERTISEMENT = array(
		'um\core\Member_Directory'          => 'Ultimate Member',
		'PMPro_Membership_Level'            => 'Paid Membership Pro',
		'WC_Admin_Assets'                   => 'Woocommerce',
		'WPCF7_Integration'                 => 'Contact Form 7',
		'WPForms_Settings'                  => 'WP Forms',
		'ElementorPro\Modules\Forms\Module' => 'Elementor Forms',
		'BuddyPress'                        => 'Buddypress',
		'ACF'                               => 'Advance Custom Fields',
		'cptui_admin_ui'                    => 'Custom Post Type UI',
		'sfwd-lms/sfwd_lms.php'             => 'Learndash',
		'GFForms'                           => 'Gravity Forms',
		'MEC'                               => 'Modern Event Calendar',
		'WPSL_Admin'                        => 'WP Store Locator',
		'Tribe__Events__Main'               => 'The Events Calendar',
		'WC_Subscriptions'                  => 'WooCommerce Subscriptions',
	);

	const REQUIRED_FIELDS_FOR_FIELD_MAP_IMPORT    = array( 'label', 'salesforce_object', 'wordpress_object', 'sync_wp_to_sf', 'sync_sf_to_wp' );
	const SUPPORTED_WORDPRESS_OBJECTS_FOR_MAPPING = array( 'user', 'post' );
	const PLUGIN_PRICING_PLANS_LANDING_PAGE_LINK  = 'https://plugins.miniorange.com/wordpress-object-sync-for-salesforce#pricing';
	const PLUGIN_DEMO_VIDEO_LIBRARY_LINK          = 'https://modemo.miniorange.com/demo/wp/salesforce';
	const SF_PACKAGE_APP_EXCHANGE_LINK            = 'https://appexchange.salesforce.com/appxListingDetail?listingId=c0695335-7279-476f-9e52-6dc177aaecfc';
	const PLUGIN_SLUG                             = 'object-data-sync-for-salesforce';

	const SALESFORCE_AUTH_ERROR_MESSAGES   = array(
		'Please install miniOrange on your connected salesforce environment',
		'Cannot connect to salesforce, please Authorize Again!',
		'Salesforce Instance URL Not Found, please Authorize Again',
	);
	const MINIORANGE_INSTALL_ERROR_MESSAGE = 'Please install miniOrange on your connected salesforce environment';
	const CONNECTION_ERROR_MESSAGE         = 'Unable to connect to Salesforce please refresh and try again';
	const PLUGIN_TABLE_NAMES               = array(
		'mo_sf_sync_object_mapping',
		'mo_sf_sync_object_mapping_meta',
		'mo_sf_sync_audit_log_db',
	);
}
