<?php
namespace SabaiApps\Directories\Component\Payment\DisplayButton;

use SabaiApps\Directories\Component\Entity\Model\Bundle;
use SabaiApps\Directories\Component\Entity\Type\IEntity;

trait DashboardDisplayButtonTrait {

	protected function _displayButtonInfo( Bundle $bundle ) {
		switch ( $this->_route ) {
			case 'renew':
				return array(
					'label'            => __( 'Renew payment plan button', 'directories-pro' ),
					'labellable'       => false,
					'default_settings' => array(
						'_color' => 'outline-secondary',
						'_icon'  => 'fas fa-arrows-rotate',
					),
					'overlayable'      => false,
				);
			case 'upgrade':
				return array(
					'label'            => __( 'Upgrade/downgrade payment plan button', 'directories-pro' ),
					'labellable'       => false,
					'default_settings' => array(
						'_color' => 'outline-secondary',
						'_icon'  => 'fas fa-arrows-up-down',
					),
					'overlayable'      => false,
				);
			case 'order_addon':
				return array(
					'label'            => __( 'Order add-on button', 'directories-pro' ),
					'labellable'       => false,
					'default_settings' => array(
						'_color' => 'outline-secondary',
						'_icon'  => 'fas fa-cart-plus',
					),
					'overlayable'      => false,
				);
			case 'cancel_subscription':
				return array(
					'label'            => __( 'Cancel subscription button', 'directories-pro' ),
					'labellable'       => false,
					'default_settings' => array(
						'_color' => 'outline-secondary',
						'_icon'  => 'fas fa-ban',
					),
					'overlayable'      => false,
				);
		}
	}

	protected function _getLabel( Bundle $bundle, IEntity $entity, array $settings ) {
		switch ( $this->_route ) {
			case 'renew':
				return __( 'Renew', 'directories-pro' );
			case 'upgrade':
				return $entity->getSingleFieldValue( 'payment_plan' ) ? __( 'Upgrade / Downgrade', 'directories-pro' ) : __( 'Purchase Plan', 'directories-pro' );
			case 'order_addon':
				return __( 'Order Add-on', 'directories-pro' );
			case 'cancel_subscription':
				return __( 'Cancel Subscription', 'directories-pro' );
		}
	}
}
