<?php
/**
 * YATOON_Vagaro_API - FREE stub
 *
 * Real implementation lives in the Pro package
 * (includes/pro/class-yatoon-vagaro-api.php). All methods here return
 * WP_Error or safe defaults so the free version never crashes when admin
 * code paths reach Vagaro.
 *
 * [FREE]
 */
if ( ! defined( 'ABSPATH' ) ) exit;

class YATOON_Vagaro_API {

    public function __construct( $api_key = '', $business_id = '' ) {}

    private function _pro_required( $method ) {
        $upgrade_url = class_exists( 'YATOON_License' ) && method_exists( 'YATOON_License', 'get_upgrade_url' )
            ? YATOON_License::get_upgrade_url()
            : '';
        return new WP_Error(
            'yatoon_pro_required',
            /* translators: %s: name of the Vagaro API method that was called. */
            sprintf( __( 'Vagaro integration (%s) requires Yatoon Pro.', 'yatoon-booking-system' ), $method ),
            array( 'is_pro_gate' => true, 'upgrade_url' => $upgrade_url )
        );
    }

    /** Catch-all for any Vagaro API method the core code may call. */
    public function __call( $name, $args ) {
        return $this->_pro_required( $name );
    }

    public static function __callStatic( $name, $args ) {
        return new WP_Error(
            'yatoon_pro_required',
            /* translators: %s: name of the Vagaro API method that was called. */
            sprintf( __( 'Vagaro integration (%s) requires Yatoon Pro.', 'yatoon-booking-system' ), $name ),
            array( 'is_pro_gate' => true )
        );
    }

    /** Admin "Test Connection" expects an array shape. */
    public function test_connection() {
        return array(
            'success'     => false,
            'error'       => __( 'Vagaro sync is a Pro feature. Upgrade to enable it.', 'yatoon-booking-system' ),
            'is_pro_gate' => true,
        );
    }

    public static function is_configured() { return false; }
    public function is_enabled()           { return false; }
}
