using System;
using System.IO;
using System.Runtime.InteropServices;
using MCPForUnity.Editor.Constants;
using MCPForUnity.Editor.Helpers;
using MCPForUnity.Editor.Services;
using UnityEditor;
using UnityEditor.UIElements;
using UnityEngine;
using UnityEngine.UIElements;
namespace MCPForUnity.Editor.Windows.Components.Settings
{
///
/// Controller for the Settings section of the MCP For Unity editor window.
/// Handles version display, debug logs, validation level, and advanced path overrides.
///
public class McpSettingsSection
{
// UI Elements
private Label versionLabel;
private Toggle debugLogsToggle;
private EnumField validationLevelField;
private Label validationDescription;
private Foldout advancedSettingsFoldout;
private TextField uvxPathOverride;
private Button browseUvxButton;
private Button clearUvxButton;
private VisualElement uvxPathStatus;
private TextField gitUrlOverride;
private Button browseGitUrlButton;
private Button clearGitUrlButton;
private Toggle devModeForceRefreshToggle;
private TextField deploySourcePath;
private Button browseDeploySourceButton;
private Button clearDeploySourceButton;
private Button deployButton;
private Button deployRestoreButton;
private Label deployTargetLabel;
private Label deployBackupLabel;
private Label deployStatusLabel;
// Data
private ValidationLevel currentValidationLevel = ValidationLevel.Standard;
// Events
public event Action OnGitUrlChanged;
public event Action OnHttpServerCommandUpdateRequested;
// Validation levels
private enum ValidationLevel
{
Basic,
Standard,
Comprehensive,
Strict
}
public VisualElement Root { get; private set; }
public McpSettingsSection(VisualElement root)
{
Root = root;
CacheUIElements();
InitializeUI();
RegisterCallbacks();
}
private void CacheUIElements()
{
versionLabel = Root.Q