<?php
/**
 * Settings admin page with tabs.
 *
 * @package SuiteMkt3k
 */

namespace SuiteMkt3k\Admin\Pages;

use SuiteMkt3k\Modules\Settings\Settings_Manager;
use SuiteMkt3k\Security\Capabilities;
use SuiteMkt3k\Security\Nonces;
use SuiteMkt3k\Utils\I18n;

defined( 'ABSPATH' ) || exit;

final class Settings_Page extends Base_Page {

	protected static string $slug = 'suitemkt3k-settings';
	protected static string $cap  = Capabilities::EDIT_SETTINGS;

	public static function render(): void {
		static::$page_title    = __( 'Settings', 'suitemkt3k' );
		static::$page_subtitle = __( 'General configuration for your marketing suite', 'suitemkt3k' );
		parent::render();
	}

	protected static function content(): void {
		$settings = Settings_Manager::all_for_display();
		$tab = \SuiteMkt3k\Utils\Sanitizer::get( 'tab', 'key' );
		$active = '' !== $tab ? $tab : 'company';
		$locales  = I18n::available_locales();
		$nonce    = Nonces::create( Nonces::ADMIN_ACTION );
		$backups  = \SuiteMkt3k\Modules\Backup\Backup_Manager::list_stored();
		include SUITEMKT3K_PATH . 'includes/admin/views/settings.php';
	}
}
