<?php

namespace CarDealerPress\Templates\Admin\Shortcode;

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

use CarDealerPress\includes\helpers\helpers as helpers;
use CarDealerPress\Templates\Admin as templates;

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

	$tab     = $safe['tab'] ?? 'inventory_list';
	$section = $safe['section'] ?? 'list_parameters';

	$content = '<div id="cdp-advanced-wrapper" class="settings-wrapper display">';
	$content .= '<div class="wrap">';
	$content .= '<nav class="nav-tab-wrapper">';
	$content .= '<a href="?page=cardealerpress_shortcodes&tab=inventory_list&section=list_parameters" class="nav-tab ' . ( 'list_parameters' === $section ? 'nav-tab-active' : '' ) . '">Paramaters</a>';
	$content .= '<a href="?page=cardealerpress_shortcodes&tab=inventory_list&section=vehicle_attributes" class="nav-tab ' . ( 'vehicle_attributes' === $section ? 'nav-tab-active' : '' ) . '">Vehicle Attributes</a>';
	$content .= '</nav>';
	$content .= '<div class="tab-content">';
	switch ( $section ) :
		case 'list_parameters':
			$content .= list_parameters();
			break;
		case 'vehicle_attributes':
			$content .= templates\Theme\Inventory_Display\vehicle_attributes( array( 'page'   => 'inventory_list',
			                                                                         'option' => 'cdp_shortcode_options',
			                                                                         'name'   => 'cdp_shortcode_options'
			) );
			break;
	endswitch;
	$content .= '</div>';

	return $content;
}
