<?php

namespace Fab\Controller;

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

use Fab\Interfaces\JIT_Interface;
use Fab\Controller\WC_Group;

/**
 * Featured Product Toast Type.
 *
 * @package    Fab
 * @subpackage Fab/Module
 */
class WC_Featured_Product_Toast_Type extends WC_Group implements JIT_Interface {

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

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

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

    /**
     * JIT Method.
     *
     * @return void
     */
    public static function jit() {
        // Prevent error if woocommerce plugin is not active.
        if ( ! FAB_WOOCOMMERCE_PLUGIN_ACTIVE ) {
            return;
        }

        // Add group type.
        add_filter( 'fab_types_group_toast', 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 );
    }
}
