<?php

namespace CarDealerPress\Templates\Admin\Theme\Navigation;

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

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

function inventory_display_nav(): string {
	// @codingStandardsIgnoreStart
	$safe = helpers::sanitize_get( $_GET );
	// @codingStandardsIgnoreEnd
	$section = $safe['section'] ?? 'general';

	$content = '<div id="cdp-detail-wrapper" class="settings-wrapper display">';
	$content .= '<div class="wrap">';
	$content .= '<nav class="nav-tab-wrapper">';
	$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=general" class="nav-tab ' . ( 'general' === $section ? 'nav-tab-active' : '' ) . '">General</a>';
	$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=prices" class="nav-tab ' . ( 'prices' === $section ? 'nav-tab-active' : '' ) . '">Prices</a>';
	$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=list&section1=general" class="nav-tab ' . ( 'list' === $section ? 'nav-tab-active' : '' ) . '">List</a>';
	$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=detail&section1=general" class="nav-tab ' . ( 'detail' === $section ? 'nav-tab-active' : '' ) . '">Detail</a>';
	$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=payment_calculator&section1=used"	class="nav-tab ' . ( 'payment_calculator' === $section ? 'nav-tab-active' : '' ) . '">Payment Calculator</a>';
	$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=banners" class="nav-tab ' . ( 'banners' === $section ? 'nav-tab-active' : '' ) . '">Banners</a>';
	$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=tags" class="nav-tab ' . ( 'tags' === $section ? 'nav-tab-active' : '' ) . '">Tags</a>';
	$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=script_assets" class="nav-tab ' . ( 'script_assets' === $section ? 'nav-tab-active' : '' ) . '">Script Assets</a>';
	$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=style_assets" class="nav-tab ' . ( 'style_assets' === $section ? 'nav-tab-active' : '' ) . '">Styles Assets</a>';
	$content .= '</nav>';
	$content .= '<div class="tab-content">';
	switch ( $section ) :
		case 'general':
			$content .= templates\theme\list_and_detail();
			break;
		case 'prices':
			$content .= templates\theme\inventory_display\prices();
			break;
		case 'list':
			$content .= templates\theme\navigation\list_nav();
			break;
		case 'detail':
			$content .= templates\theme\navigation\detail_nav();
			break;
		case 'payment_calculator':
			$content .= templates\theme\inventory_display\payment_calculator();
			break;
		case 'banners':
			$content .= templates\theme\inventory_display\banners();
			break;
		case 'tags':
			$content .= templates\theme\tags();
			break;
		case 'script_assets':
			$content .= templates\theme\script_assets();
			break;
		case 'style_assets':
			$content .= templates\theme\style_assets();
			break;
	endswitch;
	$content .= '</div>';

	return $content;
}
