<?php
namespace SabaiApps\Directories\Component\Voting\Type;

class BookmarkType extends AbstractType {

	protected function _votingTypeInfo() {
		return array(
			'label'                   => __( 'Bookmarks', 'directories-pro' ),
			'label_button'            => __( 'Bookmark button', 'directories-pro' ),
			'label_action'            => _x( 'Bookmark', 'action', 'directories-pro' ),
			'label_unaction'          => _x( 'Unbookmark', 'action', 'directories-pro' ),
			'label_statistic'         => __( 'Bookmark count', 'directories-pro' ),
			'icon'                    => 'far fa-heart',
			'icon_active'             => 'fas fa-heart',
			'min'                     => 1,
			'max'                     => 1,
			'step'                    => 1,
			'allow_empty'             => false,
			'allow_anonymous'         => true,
			'anonymous_use_cookie'    => true,
			'require_permission'      => true,
			'require_down_permission' => false,
			'require_own_permission'  => false,
			'permission_label'        => __( 'Bookmark %s', 'directories-pro' ),
			'vote_button'             => true,
			'entity_statistic'        => true,
			'vote_table_headers'      => array(
				'author'  => __( 'User', 'directories-pro' ),
				'created' => __( 'Date', 'directories-pro' ),
			),
		);
	}

	public function votingTypeFormat( array $value, $format = null ) {
		switch ( $format ) {
			case 'num':
			case 'column':
				return (int) $value['count'];
			default:
				return $this->_application->H( _n( '%d bookmark', '%d bookmarks', $value['count'], 'directories-pro' ) );
		}
	}
}
