<?php
/**
 * Customization helper functions for premium features
 *
 * Handles button text and feature toggles.
 */

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

/**
 * Render info icon with tooltip
 *
 * @param string $text Tooltip text
 * @return string HTML for info icon
 */
if (!function_exists('psfa_info_tip')) {
    function psfa_info_tip($text) {
        return sprintf(
            '<span class="psfa-info-tip dashicons dashicons-info-outline" title="%s" style="color: #2271b1; font-size: 16px; width: 16px; height: 16px; margin-left: 2px; cursor: help; vertical-align: super; display: inline-block;"></span>',
            esc_attr($text)
        );
    }
}

/**
 * Get custom button text
 *
 * @return string Button text
 */
function psfa_get_button_text() {
    
    return 'Buy on Amazon'; // Default in free build
}

/**
 * Get premium feature settings
 *
 * @return array Feature toggle states
 */
function psfa_get_features() {
    $defaults = array(
        'deal_badge'       => true,
        'deal_countdown'   => true,
        'prime_exclusive'  => true,
        'low_stock'        => true,
        'buybox_winner'    => false,
        'used_price'       => false,
    );

    
    return $defaults;
}

/**
 * Check if a specific feature is enabled
 *
 * @param string $feature Feature key
 * @return bool True if enabled
 */
function psfa_is_feature_enabled($feature) {
    $features = psfa_get_features();
    return !empty($features[$feature]);
}
