using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using MCPForUnity.Editor.Clients;
using MCPForUnity.Editor.Helpers;
using MCPForUnity.Editor.Models;
using MCPForUnity.Editor.Services;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
namespace MCPForUnity.Editor.Windows.Components.ClientConfig
{
///
/// Controller for the Client Configuration section of the MCP For Unity editor window.
/// Handles client selection, configuration, status display, and manual configuration details.
///
public class McpClientConfigSection
{
// UI Elements
private DropdownField clientDropdown;
private Button configureAllButton;
private VisualElement clientStatusIndicator;
private Label clientStatusLabel;
private Button configureButton;
private VisualElement claudeCliPathRow;
private TextField claudeCliPath;
private Button browseClaudeButton;
private TextField configPathField;
private Button copyPathButton;
private Button openFileButton;
private TextField configJsonField;
private Button copyJsonButton;
private Label installationStepsLabel;
// Data
private readonly List configurators;
private int selectedClientIndex = 0;
public VisualElement Root { get; private set; }
public McpClientConfigSection(VisualElement root)
{
Root = root;
configurators = MCPServiceLocator.Client.GetAllClients().ToList();
CacheUIElements();
InitializeUI();
RegisterCallbacks();
}
private void CacheUIElements()
{
clientDropdown = Root.Q("client-dropdown");
configureAllButton = Root.Q