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

use SabaiApps\Directories\Component\Entity;

class OrderEntityBundleType extends Entity\BundleType\AbstractBundleType {

	protected function _entityBundleTypeInfo() {
		return array(
			'type'                   => $this->_name,
			'entity_type'            => 'post',
			'slug'                   => 'orders',
			'parent_field'           => 'paymentgateway_order',
			'suffix'                 => 'pay_ord',
			'component'              => 'PaymentGateway',
			'icon'                   => 'fas fa-receipt',
			'public'                 => false,
			'no_title'               => true,
			'title_field'            => 'paymentgateway_order',
			'no_content'             => true,
			'label'                  => __( 'Orders', 'directories-pro' ),
			'label_singular'         => __( 'Order', 'directories-pro' ),
			'label_all'              => __( 'Orders', 'directories-pro' ),
			'label_count'            => __( '%s order', 'directories-pro' ),
			'label_count2'           => __( '%s orders', 'directories-pro' ),
			'label_author'           => __( 'Customer', 'directories-pro' ),
			'fields'                 => __DIR__ . '/order_fields.php',
			'displays'               => __DIR__ . '/order_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'                      => __( 'Order Number Settings', 'directories-pro' ),
			'paymentgateway_order_number' => array(
				'#tree' => true,
			) + $this->_application->Entity_NumberFormat_settingsForm(
				isset( $settings['paymentgateway_order_number'] ) ? $settings['paymentgateway_order_number'] : array(),
				array_merge( $parents, array( 'paymentgateway_order_number' ) )
			),
		);
	}
}
