<?php
/**
 * Upgrade / Pro Edition module.
 *
 * @package Noesia_Commerce_Suite
 */

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

/**
 * Free-owned Pro marketing page.
 *
 * This module belongs to the Free core so the upgrade page, copy and images
 * remain available when the /pro/ folder is removed for WordPress.org builds.
 */
class Noesia_CS_Upgrade_Pro_Module extends Noesia_CS_Admin_Module {
	/**
	 * Constructor.
	 */
	public function __construct() {
		$this->key         = 'upgrade-pro';
		$this->label       = __( 'Explore Pro', 'noesia-commerce-suite' );
		$this->icon        = '✦';
		$this->description = __( 'Explore the Pro commerce layer for live checkout, QR care, reminders, analytics and premium WooCommerce workflows.', 'noesia-commerce-suite' );
		$this->view        = 'modules/upgrade-pro/views/admin.php';
		$this->primary     = false;
	}

	/**
	 * Return a dynamic label.
	 *
	 * @return string
	 */
	public function label() {
		$feature_service = $this->service( 'feature_service' );
		$is_pro_active   = $feature_service && method_exists( $feature_service, 'is_pro_active' ) ? $feature_service->is_pro_active() : false;

		return $is_pro_active ? __( 'Pro Edition', 'noesia-commerce-suite' ) : __( 'Explore Pro', 'noesia-commerce-suite' );
	}

	/**
	 * Prepare view data.
	 *
	 * @param array $context Render context.
	 * @return array
	 */
	public function prepare_data( $context = array() ) {
		$feature_service = $this->service( 'feature_service' );
		$is_pro_active   = $feature_service && method_exists( $feature_service, 'is_pro_active' ) ? $feature_service->is_pro_active() : false;

		return array(
			'is_pro_active'     => $is_pro_active,
			'asset_base_url'    => trailingslashit( NOESIA_CS_URL . 'assets/img/pro-page' ),
			'asset_base_path'   => trailingslashit( NOESIA_CS_PATH . 'assets/img/pro-page' ),
			'matrix_base_url'   => trailingslashit( NOESIA_CS_URL . 'assets/img/matrix-world' ),
			'matrix_base_path'  => trailingslashit( NOESIA_CS_PATH . 'assets/img/matrix-world' ),
		);
	}
}
