<?php
/**
 * Load admin view for Form SMS Notification.
 *
 * @package miniorange-sms-order-notification-otp-verification/notifications/formsmsnotification
 */

namespace WCSMSOTP\Notifications\FormSMSNotification;

use WCSMSOTP\Notifications\FormSMSNotification\Handler\FormSMSNotificationsHandler;
use WCSMSOTP\Notifications\FormSMSNotification\Helper\FormSMSNotificationsList;
use WCSMSOTP\Notifications\FormSMSNotification\Helper\FormSMSNotificationMessages;
use WCSMSOTP\Helper\AddOnList;
use WCSMSOTP\Objects\AddOnInterface;
use WCSMSOTP\Objects\BaseAddOn;
use WCSMSOTP\Traits\Instance;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
require_once plugin_dir_path( __FILE__ ) . 'formnotifautoload.php';

/**
 * This is the constant class which consists of the necessary function used in the addon.
 */
if ( ! class_exists( 'FormSubmissionSMSNotification' ) ) {
	/**
	 * FormSubmissionSMSNotification class
	 */
	final class FormSubmissionSMSNotification extends BaseAddOn implements AddOnInterface {

		use Instance;

		/**
		 * Initializes values
		 */
		public function __construct() {
			parent::__construct();
			add_action( 'mo_otp_verification_delete_addon_options', array( $this, 'form_sms_notif_delete_options' ) );
		}

		/**
		 * Initialize all handlers associated with the addon
		 */
		public function initialize_handlers() {
			$list = AddOnList::instance();

			$handler = FormSMSNotificationsHandler::instance();
		}

		/**
		 * Initialize all helper associated with the addon
		 */
		public function initialize_helpers() {
			FormSMSNotificationMessages::instance();
			FormSMSNotificationsList::instance();
		}


		/**
		 * This function hooks into the s
		 * hook to show form notification settings page and forms for
		 * validation.
		 *
		 * @todo change the addon framework to notifications framework
		 */
		public function show_addon_settings_page() {
		}

		/**
		 * Function is called during deletion of the plugin to delete any options
		 * related to the add-on. This function hooks into the 'mo_otp_verification_delete_addon_options'
		 * hook of the OTP verification plugin.
		 */
		public function form_sms_notif_delete_options() {
			delete_option( 'mo_form_sms_notification_settings' );
			if ( is_multisite() ) {
				delete_site_option( 'mo_form_sms_notification_settings' );
			}
		}
	}
}
