<?php

namespace WcElectronInvoice\WooCommerce\Providers;

use WcElectronInvoice\Providers\ProductsProviderAbstract;
use WcElectronInvoice\Providers\ProductsQuery;

defined( 'ABSPATH' ) || die( 'Not allowed.' );

class ProductsProvider extends ProductsProviderAbstract {

	/**
	 * @param $args
	 *
	 * @return array|\WC_Product[]	 */
	function getProducts( $args = array() ) {
		return \wc_get_products($args);
	}

	function getProduct( $product_id ) {
		return \wc_get_product($product_id);
	}

	/**
	 * Enqueue the provider
	 * @return void
	 */
	function enqueue() {
		ProductsQuery::instance()->register_provider($this);
	}

	/**
	 * @inheritDoc
	 */
	function name() {
		return 'woocommerce';
	}
}
