<?php
/**
 * ACFWP Check Trait
 *
 * Shared trait for checking if Advanced Coupons Premium plugin is active.
 *
 * @package SAAI\Traits
 */

namespace SAAI\Traits;

defined( 'ABSPATH' ) || exit;

/**
 * ACFWP Check Trait
 *
 * Provides a reusable method to check if the Advanced Coupons for WooCommerce
 * Premium plugin is active. Used by REST controllers that depend on ACFWP Premium.
 *
 * @since 1.1.4
 */
trait ACFWP_Check_Trait {

    /**
     * ACFWP Premium plugin basename.
     *
     * @since 1.1.4
     * @var string
     */
    private static $acfwp_plugin_file = 'advanced-coupons-for-woocommerce/advanced-coupons-for-woocommerce.php';

    /**
     * Check if ACFWP Premium is active.
     *
     * @since 1.1.4
     * @return bool True if premium is active.
     */
    private function is_acfwp_premium_active() {
        if ( ! function_exists( 'is_plugin_active' ) ) {
            require_once ABSPATH . 'wp-admin/includes/plugin.php';
        }

        return is_plugin_active( self::$acfwp_plugin_file );
    }
}
