<?php
/**
 * Class Pixelio_Cart_Abandon_Recovery_More_All_Input
 *
 * Base class for all reusable input types in the plugin.
 * Handles common properties such as label, description, saved value,
 * dependencies, and pro/preview/edit states.
 *
 * @package PixelioCartAbandonRecoveryMore\Admin\Views\Reusable
 */

namespace PixelioCartAbandonRecoveryMore\Admin\Views\Reusable;

	use PixelioCartAbandonRecoveryMore\Includes\Utils\Pixelio_Cart_Abandon_Recovery_More_Util;

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

	/**
	 * Class Pixelio_Cart_Abandon_Recovery_More_All_Input
	 *
	 * Base class for all reusable input types in the plugin.
	 * Handles common properties such as label, description, saved value,
	 * dependencies, and pro/preview/edit states.
	 *
	 * @package PixelioCartAbandonRecoveryMore\Admin\Views\Reusable
	 */
class Pixelio_Cart_Abandon_Recovery_More_All_Input {

	/**
	 * Short description of the input.
	 * Used to explain the purpose of the input in the admin interface.
	 *
	 * @var string
	 */
	protected $description;

	/**
	 * Label displayed next to the input.
	 * Used to visually identify the input for the user.
	 *
	 * @var string
	 */
	protected $label;

	/**
	 * Unique name of the input.
	 * Used to identify the input in forms and for saving values.
	 *
	 * @var string
	 */
	protected $name;

	/**
	 * Indicates if the input is reserved for Pro users.
	 *
	 * @var bool
	 */
	protected $pro;

	/**
	 * Indicates if the input can be previewed in the admin interface.
	 *
	 * @var bool
	 */
	protected $preview;

	/**
	 * Indicates if the input can be edited in the admin interface.
	 *
	 * @var bool
	 */
	protected $edit;

	/**
	 * Contains any error message for the input.
	 *
	 * @var string
	 */
	protected $error = '';

	/**
	 * CSS class used for input preview.
	 *
	 * @var string
	 */
	protected $preview_class;

	/**
	 * Placeholder text displayed inside the input.
	 *
	 * @var string
	 */
	protected $placeholder;

	/**
	 * Saved value of the input.
	 * Contains the value retrieved from the database or POST.
	 *
	 * @var mixed
	 */
	protected $pixelio_cart_abandon_recovery_more_saved_value;

	/**
	 * Disabled attribute for the input.
	 * Used to disable the input if necessary.
	 *
	 * @var string
	 */
	protected $disabled;

	/**
	 * Array of available input types (number, text).
	 *
	 * @var array
	 */
	protected $type_array = array( 'number', 'text' );

	/**
	 * Current type of the input (number or text).
	 *
	 * @var string
	 */
	protected $type;

	/**
	 * Name of the input this input depends on.
	 * Allows conditional display based on other inputs.
	 *
	 * @var string
	 */
	protected $dependency_name;

	/**
	 * Current value of the input.
	 * Used for display and logic.
	 *
	 * @var mixed
	 */
	protected $value;

	/**
	 * Retrieves the saved value of the input.
	 * Returns an empty array if no value exists.
	 *
	 * @return array Associative array [input_name => saved_value]
	 */
	public function get_saved_value() {
		if ( null === $this->pixelio_cart_abandon_recovery_more_saved_value ) {
			return array();
		} else {
			return array( $this->name => $this->pixelio_cart_abandon_recovery_more_saved_value );
		}
	}
}
