<?php
/**
 * Built-in Revio Extension
 * WooCommerce Integration
 *
 * @package RVIOR
 */

namespace RVIOR\Extensions;

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit( 1 );


if ( ! class_exists( __NAMESPACE__ . '\WooCommerce' ) ) {

	/**
	 * Class WooCommerce
	 *
	 * @package RVIOR
	 */
	class WooCommerce extends \RVIOR\Base\Extension {

		// Use utility trait.
		use \RVIOR\Traits\Utilities;

		/**
		 * Return the extension id
		 *
		 * @return string
		 */
		public function id() {
			return 'woocommerce';
		}

		/**
		 * Return the extension name
		 *
		 * @return string
		 */
		public function name() {
			return esc_html__( 'WooCommerce', 'revio-reviews' );
		}

		/**
		 * Returns the extension icon url
		 */
		public function icon_url() {
			return RVIOR_PUBLIC . 'images/icons/woocommerce.png';
		}

		/**
		 * Return the extension body
		 *
		 * @return void
		 */
		public function form() {
			$this->render_template( 'admin/integrations/built-in/woocommerce' );
			$this->render_template( 'admin/integrations/built-in/email-footer' );
		}

		/**
		 * Return the extension options
		 *
		 * @return array
		 */
		public function options() {
			return [
				'single_tab'               => '1',
				'hide_default_reviews_tab' => false,
				'single_button'            => '1',
				'single_tab_showcase'      => false,
				'single_tab_label'         => esc_html__( 'Video Reviews', 'revio-reviews' ),
				'single_order_by'          => 'date',
				'single_order'             => 'desc',
				'order_complete_button'    => false,
				'order_complete_email'     => false,
			];
		}

		/**
		 * Return the extension script
		 */
		public function script() {
			return [
				'is_active' => class_exists( '\WooCommerce' ),
			];
		}
	}

}
