<?php

namespace CarDealerPress\Templates\Admin\Admin;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use CarDealerPress\includes\helpers\helpers as helpers;

function advanced() {
	// @codingStandardsIgnoreStart
	$safe = helpers::sanitize_get( $_GET );
	// @codingStandardsIgnoreEnd

	$tab     = $safe['tab'] ?? 'advanced';
	$section = $safe['section'] ?? 'dealers';

	$content = '<div id="cdp-advanced-wrapper" class="settings-wrapper display">';
	$content .= '<div class="wrap">';
	$content .= '<nav class="nav-tab-wrapper">';
	// TODO FUTURE: Does add dealer to inventory, but Geo settings do not work (currently how legacy works), other search filters work.
	$content .= '<a href="?page=cardealerpress_admin&tab=advanced&section=dealers" class="nav-tab ' . ( 'dealers' === $section ? 'nav-tab-active' : '' ) . '">Dealers</a>';
	$content .= '<a href="?page=cardealerpress_admin&tab=advanced&section=import_filters" class="nav-tab ' . ( 'import_filters' === $section ? 'nav-tab-active' : '' ) . '">Import Filters</a>';
	$content .= '</nav>';
	$content .= '<div class="tab-content">';
	switch ( $section ) :
		case 'dealers':
			$content .= dealers();
			break;
		case 'import_filters':
			$content .= import_filters();
			break;
	endswitch;
	$content .= '</div>';

	return $content;
}
