| 1 | using CascadeIDE.Cockpit; |
| 2 | |
| 3 | namespace CascadeIDE.Features.UiChrome; |
| 4 | |
| 5 | /// <summary> |
| 6 | /// Продуктовые флаги UI для режима после мержа TOML и <see cref="UiModeFamily"/> (ADR 0010 capabilities). |
| 7 | /// Значения по умолчанию повторяют прежнюю логику VM до выноса в данные. |
| 8 | /// </summary> |
| 9 | public sealed record UiModeCapabilities( |
| 10 | bool QuickActions, |
| 11 | bool AgentOperationsPanel, |
| 12 | bool AgentTrace, |
| 13 | bool AutonomousAgentTelemetry, |
| 14 | /// <summary>Дубль IDE Health на вкладке «Терминал» в Power, когда полоска под редактором скрыта. TOML: <c>ide_health_on_terminal_tab</c>.</summary> |
| 15 | bool IdeHealthOnTerminalTab, |
| 16 | /// <summary>Column span нижней зоны IDE Health в MainGrid при Power и видимой полоске под редактором. TOML: <c>ide_health_main_column_span</c>.</summary> |
| 17 | int IdeHealthMainColumnSpan, |
| 18 | /// <summary>Вкладки инструментирования (события/тесты/…), когда док включён.</summary> |
| 19 | bool InstrumentationTabs, |
| 20 | /// <summary>Вкладка «Гипотезы» в доке / страница MFD (не привязана к отдельному UI-режиму).</summary> |
| 21 | bool HypothesesTab, |
| 22 | bool RiskSummaryCard, |
| 23 | bool ResultSummaryCard, |
| 24 | /// <summary>Полоса build/tests/debug/git под редактором. TOML: <c>ide_health_strip</c>.</summary> |
| 25 | bool IdeHealthStripVisible, |
| 26 | /// <summary>Нижняя полоса vs страница зоны. TOML: <c>ide_health_surface</c>.</summary> |
| 27 | IdeHealthUiSurface IdeHealthSurface, |
| 28 | /// <summary>Вкладка Problems и учёт в <see cref="MainWindowViewModel.IsMfdContourContentVisible"/>.</summary> |
| 29 | bool ProblemsPanelVisible, |
| 30 | /// <summary>Разрешить полосу оповещений EICAS при наличии сообщений; TOML: <c>eicas_alerts_bar</c>. См. ADR 0021 §5, §1.1.</summary> |
| 31 | bool EicasAlertsBarEnabled) |
| 32 | { |
| 33 | /// <summary>Ось формы представления для канала IDE Health (ADR 0063); дублирует <see cref="IdeHealthSurface"/> через <see cref="IdeHealthUiSurfaceExtensions.ToContentRepresentation"/>.</summary> |
| 34 | public ContentRepresentation IdeHealthContentRepresentation => IdeHealthSurface.ToContentRepresentation(); |
| 35 | |
| 36 | /// <summary>Дефолты по семье, если в TOML нет переопределений и нет наследуемого родителя.</summary> |
| 37 | public static UiModeCapabilities DefaultsForFamily(UiModeFamily family) |
| 38 | { |
| 39 | if (family.IsEditorFamily()) |
| 40 | { |
| 41 | if (UiModeCatalog.TryGetEditorCapabilitiesFromEmbeddedResource(out var embedded)) |
| 42 | return embedded; |
| 43 | throw new InvalidOperationException( |
| 44 | "Семья Editor: не удалось загрузить capabilities из EmbeddedResource (UiModes/Flight.toml, UiModes/Editor.toml). Проверь CascadeIDE.csproj и манифест сборки."); |
| 45 | } |
| 46 | |
| 47 | var balanced = family.IsBalancedFamily(); |
| 48 | var flight = family.IsFlightFamily(); |
| 49 | var balancedOrFlight = balanced || flight; |
| 50 | var power = family.IsPowerFamily(); |
| 51 | var debug = family.IsDebugFamily(); |
| 52 | var focus = family.IsFocusFamily(); |
| 53 | var agentChat = family.IsAgentChatFamily(); |
| 54 | |
| 55 | return new UiModeCapabilities( |
| 56 | QuickActions: balancedOrFlight, |
| 57 | AgentOperationsPanel: balancedOrFlight, |
| 58 | AgentTrace: power, |
| 59 | AutonomousAgentTelemetry: power, |
| 60 | IdeHealthOnTerminalTab: false, |
| 61 | IdeHealthMainColumnSpan: power ? 3 : 5, |
| 62 | InstrumentationTabs: focus || balanced || flight || power || agentChat || debug, |
| 63 | HypothesesTab: flight, |
| 64 | RiskSummaryCard: !focus && !agentChat, |
| 65 | ResultSummaryCard: !focus && !agentChat, |
| 66 | IdeHealthStripVisible: true, |
| 67 | IdeHealthSurface: IdeHealthUiSurface.BottomStrip, |
| 68 | ProblemsPanelVisible: true, |
| 69 | EicasAlertsBarEnabled: true); |
| 70 | } |
| 71 | } |
| 72 | |