<?php
namespace SabaiApps\Directories\Component\PaymentGateway\EntityBundleType;

use SabaiApps\Directories\Component\Entity;

class SubscriptionEntityBundleType extends Entity\BundleType\AbstractBundleType {

	protected function _entityBundleTypeInfo() {
		return array(
			'type'                   => $this->_name,
			'entity_type'            => 'post',
			'slug'                   => 'subscriptions',
			'parent_field'           => 'paymentgateway_subscription',
			'suffix'                 => 'pay_sub',
			'component'              => 'PaymentGateway',
			'icon'                   => 'fas fa-receipt',
			'public'                 => false,
			'no_title'               => true,
			'title_field'            => 'paymentgateway_subscription',
			'no_content'             => true,
			'label'                  => __( 'Subscriptions', 'directories-pro' ),
			'label_singular'         => __( 'Subscription', 'directories-pro' ),
			'label_all'              => __( 'Subscriptions', 'directories-pro' ),
			'label_count'            => __( '%s subscription', 'directories-pro' ),
			'label_count2'           => __( '%s subscriptions', 'directories-pro' ),
			'label_author'           => __( 'Customer', 'directories-pro' ),
			'fields'                 => __DIR__ . '/subscription_fields.php',
			'displays'               => __DIR__ . '/subscription_displays.php',
			'properties'             => array(
				'author' => array(
					'label' => __( 'Customer', 'directories-pro' ),
				),
			),
			'entity_permissions'     => false,
			'dashboard_disable'      => true,
			'frontendsubmit_disable' => true,
			'restorable'             => false,
			'addable'                => false,
			'configurable'           => false,
			'faker_disable'          => true,
			'csv_disable'            => true,
		);
	}

	public function entityBundleTypeSettingsForm( array $settings, array $parents = array() ) {
		return array(
			'#title'                             => __( 'Subscription Number Settings', 'directories-pro' ),
			'paymentgateway_subscription_number' => array(
				'#tree' => true,
			) + $this->_application->Entity_NumberFormat_settingsForm(
				isset( $settings['paymentgateway_subscription_number'] ) ? $settings['paymentgateway_subscription_number'] : array(),
				array_merge( $parents, array( 'paymentgateway_subscription_number' ) )
			),
		);
	}
}
