<?php

namespace CleverReach\WooCommerce\Controllers;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

use CleverReach\WooCommerce\Components\Services\BusinessLogic\Usersnap\Contracts\Usersnap_Service_Interface;
use CleverReach\WooCommerce\IntegrationCore\Infrastructure\ServiceRegister;

/**
 * Class Clever_Reach_Usersnap_Controller
 *
 * @package CleverReach\WooCommerce\Controllers
 */
class Clever_Reach_Usersnap_Controller extends Clever_Reach_Base_Controller{

	/**
	 * Returns Usersnap data for dashboard view.
	 *
	 * @return array
	 */
	public static function get_usersnap_data() {
		$service = self::get_usersnap_service();

		return [
			'meta'    => $service->get_context(),
			'key'  => $service->get_key(),
		];
	}

	/**
	 * Retrieves Usersnap service.
	 *
	 * @return Usersnap_Service_Interface
	 */
	protected static function get_usersnap_service() {
		/**
		 * Usersnap service.
		 *
		 * @var Usersnap_Service_Interface $service
		 */
		$service = ServiceRegister::getService( Usersnap_Service_Interface::CLASS_NAME );

		return $service;
	}
}
