<?php
/**
 * This class handles the HonePot tab.
 *
 * @author     FutrX
 * @year       2023
 * @package    NoMoreBots
 * @subpackage NoMoreBots\Admin\Pages\Settings
 */

namespace NoMoreBots\Admin\Pages\BlockedList;

use Carbon_Fields\Field;
use NoMoreBots\Utils\Plugins as PluginsUtils;


class HoneyPot {

	/**
	 * Returns the Object for the Blocked Duration Field.
	 *
	 * @return Field\Field
	 */
	public static function getListOfBlockedIpsField(): Field\Field {
		return Field::make(
			'html',
			NOMOREBOTS_HONEYPOT_FIELD_PREFIX . '_blocked_ips_list',
			__( 'Blocked IPs List', NOMOREBOTS_PLUGINTEXTDOMAIN )
		)
					->set_help_text(
						__(
							'These are the list of the blocked IPs',
							NOMOREBOTS_PLUGINTEXTDOMAIN
						)
					)
					->set_html( self::getHTMLTemplate( 'blocked-ips' ) );
	}
	/**
	 * Renders the HTML string for the required field.
	 *
	 * @param string $templateName
	 *
	 * @return string
	 */
	public static function getHTMLTemplate( string $templateName ): string {
		ob_start();
		include_once NOMOREBOTS_PLUGINPATH . 'lib/Admin/Pages/BlockedList/' . $templateName . '.php';
		return ob_get_clean();
	}
}
