<?php

namespace Hyperpay\Gateways\Helpers;

use \WC_Order;

class SubscriptionsManager
{

    public static function orderContainsSubscription(WC_Order $order)
    {
        if (!\function_exists('wcs_order_contains_subscription')) {
            return false;
        }
        return wcs_order_contains_subscription($order->get_id());
    }

    public static function getSubscriptionsForOrder(WC_Order $order, $options = [])
    {
        if (!\function_exists('wcs_get_subscriptions_for_order')) {
            return [];
        }
        return wcs_get_subscriptions_for_order($order, $options);
    }

    public static function getUsersSubscriptions($userId)
    {
        if (!\function_exists('wcs_get_users_subscriptions') || !$userId) {
            return [];
        }
        return wcs_get_users_subscriptions($userId);
    }
}
