<?php
/**
 * EverestForms Social Login Settings
 *
 * @package EverestForms\Admin
 *
 * @version 1.7.9
 */

 namespace  EverestForms\Pro\Addons\UserRegistration\Settings;

use EverestForms\Pro\Addons\UserRegistration\Helper;

defined( 'ABSPATH' ) || exit;

/**
 * EVF_Settings_Social_Login.
 *
 * @since 1.7.9
 */
class EVF_Settings_Social_Login extends \EVF_Settings_Page {

	/**
	 * Constructor.
	 *
	 * @since 1.7.9
	 */
	public function __construct() {
		$this->id    = 'user_registration';
		$this->label = __( 'User Registration', 'everest-forms' );

		parent::__construct();
	}

	/**
	 * Get settings array.
	 *
	 * @since 1.7.9
	 *
	 * @return array
	 */
	public function get_settings() {
		$settings = apply_filters(
			'everest_forms_user_registration_settings',
			array(
				array(
					'title' => esc_html__( 'User Registration', 'everest-forms-pro' ),
					'type'  => 'title',
					'desc'  => '',
					'id'    => 'social_login',
				),
				array(
					'title'    => __( 'Enable Social Login', 'everest-forms-pro' ),
					'desc'     => __( 'Toggle to activate social login.', 'everest-forms-pro' ),
					'id'       => 'everest_forms_social_setting_enable_social_registration',
					'default'  => '',
					'type'     => 'toggle',
					'desc_tip' => true,
				),
				array(
					'title'    => __( 'Enable Multi Social Login', 'everest-forms-pro' ),
					'desc'     => __( 'Tick here if you want to Register once and log in with any connected social media.', 'everest-forms-pro' ),
					'id'       => 'everest_forms_social_setting_multi_social_login',
					'default'  => '',
					'type'     => 'toggle',
					'desc_tip' => true,
				),
				array(
					'title'    => __( 'Default User Role', 'everest-forms-pro' ),
					'desc'     => __( 'This option lets you choose user role for social registration.', 'everest-forms-pro' ),
					'id'       => 'everest_forms_social_setting_default_user_role',
					'default'  => 'subscriber',
					'type'     => 'select',
					'class'    => 'evf-enhanced-select',
					'desc_tip' => true,
					'options'  => Helper::evfur_get_default_admin_roles(),
				),
				array(
					'type' => 'sectionend',
					'id'   => 'social_login',
				),
				array(
					'title'      => esc_html__( 'Google', 'everest-forms-pro' ),
					'type'       => 'title',
					'desc'       => '',
					'id'    	 => 'google_login',
					'image_name' => 'google'
				),
				array(
					'title'    => __( 'Enable Google Login', 'everest-forms-pro' ),
					'desc'     => __( 'Toggle to activate Google login.', 'everest-forms-pro' ),
					'id'       => 'everest_forms_social_setting_enable_google_connect',
					'default'  => '',
					'type'     => 'toggle',
					'desc_tip' => true,
				),
				array(
					'title'    => __( 'Google Client Id', 'everest-forms-pro' ),
					'desc'     => __( 'Google client id.', 'everest-forms-pro' ),
					'id'       => 'everest_forms_social_setting_google_client_id',
					'default'  => '',
					'type'     => 'text',
					'desc_tip' => true,
				),
				array(
					'title'    => __( 'Google Client Secret', 'everest-forms-pro' ),
					'desc'     => __( 'Google client secret.', 'everest-forms-pro' ),
					'id'       => 'everest_forms_social_setting_google_client_secret',
					'default'  => '',
					'type'     => 'text',
					'desc_tip' => true,
				),
				array(
					'title'    => __( 'Login With Google Text', 'everest-forms-pro' ),
					'desc'     => __( 'Login with google string.', 'everest-forms-pro' ),
					'id'       => 'everest_forms_social_login_with_google_text',
					'default'  => 'Login With Google',
					'type'     => 'text',
					'desc_tip' => true,
				),
				array(
					'type' => 'sectionend',
					'id'   => 'google_login',
				),
				array(
					'title'      => esc_html__( 'Facebook', 'everest-forms-pro' ),
					'type'       => 'title',
					'desc'       => '',
					'id'         => 'facebook_login',
					'image_name' => 'facebook'
				),
				array(
					'title'    => __( 'Enable Facebook Login', 'everest-forms-pro' ),
					'desc'     => __( 'Toggle to activate Facebook login.', 'everest-forms-pro' ),
					'id'       => 'everest_forms_social_setting_enable_facebook_connect',
					'default'  => '',
					'type'     => 'toggle',
					'desc_tip' => true,
				),
				array(
					'title'    => __( 'Facebook App Id', 'everest-forms-pro' ),
					'desc'     => __( 'Facebook app id.', 'everest-forms-pro' ),
					'id'       => 'everest_forms_social_setting_facebook_app_id',
					'default'  => '',
					'type'     => 'text',
					'desc_tip' => true,
				),
				array(
					'title'    => __( 'Facebook App Secret', 'everest-forms-pro' ),
					'desc'     => __( 'Facebook app secret.', 'everest-forms-pro' ),
					'id'       => 'everest_forms_social_setting_facebook_app_secret',
					'default'  => '',
					'type'     => 'text',
					'desc_tip' => true,
				),
				array(
					'title'    => __( 'Login With Facebook Text', 'everest-forms-pro' ),
					'desc'     => __( 'Login with facebook string.', 'everest-forms-pro' ),
					'id'       => 'everest_forms_social_login_with_facebook_text',
					'default'  => 'Login With Facebook',
					'type'     => 'text',
					'desc_tip' => true,
				),
				array(
					'type' => 'sectionend',
					'id'   => 'facebook_login',
				),
				array(
					'title'      => esc_html__( 'Linkedin', 'everest-forms-pro' ),
					'type'       => 'title',
					'desc'       => '',
					'id'         => 'linkedin_login',
					'image_name' => 'linkedin'
				),
				array(
					'title'    => __( 'Enable Linkedin Login', 'everest-forms-pro' ),
					'desc'     => __( 'Toggle to activate Linkedin login.', 'everest-forms-pro' ),
					'id'       => 'everest_forms_social_setting_enable_linkedin_connect',
					'default'  => '',
					'type'     => 'toggle',
					'desc_tip' => true,
				),
				array(
					'title'    => __( 'Linkedin Client Id', 'everest-forms-pro' ),
					'desc'     => __( 'Linkedin client id.', 'everest-forms-pro' ),
					'id'       => 'everest_forms_social_setting_linkedin_client_id',
					'default'  => '',
					'type'     => 'text',
					'desc_tip' => true,
				),
				array(
					'title'    => __( 'Linkedin Client Secret', 'everest-forms-pro' ),
					'desc'     => __( 'Linkedin client secret.', 'everest-forms-pro' ),
					'id'       => 'everest_forms_social_setting_linkedin_client_secret',
					'default'  => '',
					'type'     => 'text',
					'desc_tip' => true,
				),
				array(
					'title'    => __( 'Login With Linkedin Text', 'everest-forms-pro' ),
					'desc'     => __( 'Login with linkedin string.', 'everest-forms-pro' ),
					'id'       => 'everest_forms_social_login_with_linkedin_text',
					'default'  => 'Login With Linkedin',
					'type'     => 'text',
					'desc_tip' => true,
				),
				array(
					'type' => 'sectionend',
					'id'   => 'linkedin_login',
				),
			)
		);

			return apply_filters( 'everest_forms_get_settings_' . $this->id, $settings );
	}

	/**
	 * Save settings.
	 *
	 * @since 1.7.9
	 */
	public function save() {
		$settings = $this->get_settings();

		\EVF_Admin_Settings::save_fields( $settings );
	}
}
