using System;
using System.IO;
using System.Runtime.InteropServices;
using MCPForUnity.Editor.Constants;
using MCPForUnity.Editor.Helpers;
using MCPForUnity.Editor.Services;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
namespace MCPForUnity.Editor.Windows.Components.Advanced
{
///
/// Controller for the Advanced Settings section.
/// Handles path overrides, server source configuration, dev mode, and package deployment.
///
public class McpAdvancedSection
{
// UI Elements
private TextField uvxPathOverride;
private Button browseUvxButton;
private Button clearUvxButton;
private VisualElement uvxPathStatus;
private TextField gitUrlOverride;
private Button browseGitUrlButton;
private Button clearGitUrlButton;
private Toggle debugLogsToggle;
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;
private VisualElement healthIndicator;
private Label healthStatus;
private Button testConnectionButton;
// Events
public event Action OnGitUrlChanged;
public event Action OnHttpServerCommandUpdateRequested;
public event Action OnTestConnectionRequested;
public VisualElement Root { get; private set; }
public McpAdvancedSection(VisualElement root)
{
Root = root;
CacheUIElements();
InitializeUI();
RegisterCallbacks();
}
private void CacheUIElements()
{
uvxPathOverride = Root.Q("uv-path-override");
browseUvxButton = Root.Q