<?php

namespace Fab\Controller;

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

use Fab\Interfaces\JIT_Interface;

/**
 * Search.
 *
 * @package    Fab
 * @subpackage Fab/Module
 */
class Search_Type extends Modal_Popup_Group implements JIT_Interface {

    /**
     * Post meta.
     *
     * @var array
     */
    protected $post_meta = array(
        'label'               => array(
            'meta_key' => 'fab_setting_search_label',
            'default'  => 'Search...',
        ),
        'pagination_enable'   => array(
            'meta_key' => 'fab_setting_search_pagination_enable',
            'default'  => true,
        ),
        'pagination_per_page' => array(
            'meta_key' => 'fab_setting_search_pagination_per_page',
            'default'  => 10,
        ),
    );

    /**
     * Constructor.
     */
    public function __construct() {
        parent::__construct();
        $this->type = 'search';
    }

    /**
     * Get labels type.
     *
     * @return array
     */
    public function get_labels_type() {
        return array(
            'name' => __( 'Search', 'floating-awesome-button' ),
        );
    }

    /*
    |--------------------------------------------------------------------------
    | Fulfill implemented interface contracts
    |--------------------------------------------------------------------------
     */

    /**
     * JIT Method.
     *
     * @return void
     */
    public static function jit() {
        // Add group type.
        add_filter( 'fab_types_group_modal', array( __CLASS__, 'jit_add_fab_types_group' ), 10, 1 );

        // Add fab setting types.
        add_filter( 'fab_setting_types', array( __CLASS__, 'jit_add_fab_setting_types' ), 10, 1 );
    }
}
