<?php

namespace WooPoPCozmosLabsPMS\Providers;

use WcElectronInvoice\Providers\OrderItemAbstract;

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

class OrderItem extends OrderItemAbstract {

	/**
	 * PMS_Subscription_Plan
	 * @var
	 */
	protected $order_item;

	function get_id() {
		return $this->order_item->id;
	}

	function get_product() {
		return new Product( $this->order_item );
	}

	function get_name() {
		return $this->order_item->name;
	}

	function get_total() {
		return $this->order_item->price;
	}

	function get_total_tax() {
		return $this->order_item->total_tax;
	}

	function get_sku() {
		// PMS doesn't support SKUs
		return '';
	}

	function get_data() {
		return [
			'id' => $this->get_id(),
			'order_id' => $this->order_item->order_id,
			'name' => $this->get_name(),
			'product_id' => $this->get_product_id(),
			'variation_id' => $this->get_variation_id(),
			'quantity' => 1,
			'tax_class' => $this->get_tax_class(),
			'subtotal' => $this->get_total(),
			'subtotal_tax' => $this->get_total_tax(),
			'total' => $this->get_total(),
			'total_tax' => $this->get_total_tax(),
			'taxes' => [
				'subtotal' => [$this->get_total_tax()],
				'total' => [$this->get_total_tax()],
			],
			'meta_data' => [],
			'provider' => 'cozmoslabspms',
		];
	}

	function get_tax_class() {
		return '';
	}
}
