<?php

namespace WooPoPCozmosLabsPMS\Providers;

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

class Product extends \WcElectronInvoice\Providers\ProductAbstract {

	/**
	 * @var \PMS_Subscription_Plan
	 */
	protected $product;


	function get_id() {
		return $this->product->id;
	}
	function get_sku() {
		return (string) $this->get_id();
	}

	function get_tax_class() {
		return '';
	}

	public function get_tax_status() {

		// tax exempt or not
		// PMS save it in the WP post meta
		// taxable => 1, tax_exempt => 0
		// WooCommerce saves the non-taxable as 'none', entirely taxable as 'taxable'
		// and 'shipping' for taxes only on shipping

		$taxExempt = (bool) get_post_meta( $this->product->id, 'pms_subscription_plan_tax_exempt', true );

		return $taxExempt ? 'none' : 'taxable';

	}

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

	function get_short_description() {
		// PMS doesn't have a short description,
		// using the description instead
		return $this->product->description;
	}

	function get_description() {
		return $this->product->description;
	}
}
