<?php

namespace POPxPMPro\Providers;

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

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

class ProductsProvider extends ProductsProviderAbstract {

	/**
	 * @inheritDoc
	 */
	function getProducts( $args = array() ) {
		global $wpdb;

		$products = [];

		$args = $this->mapArgs( $args );

		// make the query against the pmpro levels table
		// new Product( for each matching level)

		return $products;

	}

	/**
	 * @inheritDoc
	 */
	function getProduct( $product_id ) {
		return new Product( new \PMPro_Membership_Level( $product_id ) );
	}

	/**
	 * @inheritDoc
	 */
	function enqueue() {
		ProductsQuery::instance()->register_provider( $this );
	}

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

	/**
	 * @inheritDoc
	 */
	private function mapArgs( $args ) {
		return $args;
	}
}
