<?php
/**
 * Class Noesia Cs Settings Module.
 *
 * @package Noesia_Commerce_Suite
 */

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

/**
 * Class implementation.
 */
class Noesia_CS_Settings_Module extends Noesia_CS_Admin_Module {
	/**
	 * Handles the related plugin operation.
	 */
	public function __construct() {
		$this->key         = 'settings';
		$this->label       = __( 'Settings', 'noesia-commerce-suite' );
		$this->icon        = '⚙';
		$this->description = __( 'Detailed control center for the commerce suite.', 'noesia-commerce-suite' );
		$this->view        = 'modules/settings/views/admin.php';
		$this->primary     = false;
	}

	/**
	 * Handles the related plugin operation.
	 *
	 * @param mixed $context Context.
	 */
	public function prepare_data( $context = array() ) {
		$admin         = isset( $context['admin'] ) ? $context['admin'] : null;
		$data_service  = $this->service( 'data_service' );
		return array(
			'sections'         => $admin && method_exists( $admin, 'settings_sections' ) ? $admin->settings_sections( 'settings' ) : array(),
			'cleanup_summary'  => $data_service && method_exists( $data_service, 'get_last_cleanup_summary' ) ? $data_service->get_last_cleanup_summary() : array(),
		);
	}

}
