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

use SabaiApps\Directories\Component\Entity\Type\IEntity;
use SabaiApps\Directories\Component\Payment\IPlan;
use SabaiApps\Directories\Component\Payment\IOrder;
use SabaiApps\Directories\Component\Payment\ISubscription;
use SabaiApps\Directories\Context;

interface IComponent {

	public function paymentComponentInfo( $key = null );
	public function paymentComponentName();
	public function paymentIsEnabled();
	public function paymentIsGuestCheckoutEnabled();
	public function paymentIsGuestSignupEnabled();
	public function paymentIsGuestLoginEnabled();
	/**
	 * @return string
	 */
	public function paymentGetCurrency();
	public function paymentGetCurrencySymbol();
	public function paymentGetPlanIds( $bundleName, $lang = null );
	/**
	 * @return IPlan|null
	 */
	public function paymentGetPlanById( $bundleName, $id );
	/**
	 * @return IOrder|null
	 */
	public function paymentGetOrderById( $orderId );
	/**
	 * @return array
	 */
	public function paymentGetOrders( IEntity $entity, $limit = 0, $offset = 0 );
	/**
	 * @return array
	 */
	public function paymentGetUserOrders( $userId, $limit = 0, $offset = 0 );
	/**
	 * @return int
	 */
	public function paymentCountUserOrders( $userId );
	/**
	 * @param IEntity $entity
	 * @param array   $actions
	 * @return bool
	 */
	public function paymentHasPendingOrder( IEntity $entity, array $actions );

	/**
	 * @param Context      $context
	 * @param IPlan|IOrder $planOrOrder
	 * @param IEntity|null $entity
	 * @param string|null  $action
	 * @return array
	 */
	public function paymentCheckoutForm( Context $context, $planOrOrder, ?IEntity $entity = null, $action = null );
	public function paymentCheckoutComplete( Context $context, IPlan $plan, IEntity $entity, $action );
	/**
	 * @return bool
	 */
	public function paymentIsSubscriptionEnabled();
	/**
	 * @param string $subscriptionId
	 * @return ISubscription|null
	 */
	public function paymentGetSubscriptionById( $subscriptionId );
	/**
	 * @param IEntity $entity
	 * @param int     $limit
	 * @param int     $offset
	 * @return ISubscription|null
	 */
	public function paymentGetSubscriptions( IEntity $entity, $limit = 0, $offset = 0 );
	/**
	 * @return array
	 */
	public function paymentGetUserSubscriptions( $userId, $limit = 0, $offset = 0 );
	/**
	 * @return int
	 */
	public function paymentCountUserSubscriptions( $userId );
	/**
	 * @return int
	 */
	public function paymentGetClaimOrderId( IEntity $claim, IEntity $claimedEntity );

	public function paymentRefundOrder( $orderId, $reason = '' );

	public function paymentGetPlanId( $bundleName, $planId, $lang );

	public function paymentSettingsForm( array $settings, array $parents );

	public function paymentCheckoutBtnText( $bundleName, $action, $planId = null );

	public function paymentFormatPlanPrice( IPlan $plan );
	public function paymentGetOrderDetailHtml( IOrder $order );
	public function paymentGetSubscriptionDetailHtml( ISubscription $subscription );
	public function paymentIsOrderCancellable();
	public function paymentCancelOrder( IOrder $order, $isManual = false );
	public function paymentIsSubscriptionCancellable();
	public function paymentCancelSubscription( ISubscription $subscription, $isManual = false );
	public function paymentGetPlanContentBundleName( IPlan $plan );
	public function paymentPlanHasDiscount( IPlan $plan );
}
