| 1 | using CascadeIDE.Cockpit.Channels.Eicas; |
| 2 | using CascadeIDE.Cockpit.Channels.WorkspaceHealth; |
| 3 | |
| 4 | namespace CascadeIDE.Cockpit.ComputingUnits.IdeHealth; |
| 5 | |
| 6 | /// <summary> |
| 7 | /// Входные строки одного сегмента до маппинга в <see cref="IdeHealthSegment"/>. |
| 8 | /// <see cref="IsBuildRunning"/> учитывается только для источника <see cref="IdeHealthSource.Build"/>. |
| 9 | /// </summary> |
| 10 | public readonly record struct IdeHealthSegmentInput( |
| 11 | string LineText, |
| 12 | string CockpitShort, |
| 13 | bool IsBuildRunning = false, |
| 14 | IdeHealthStratum Stratum = IdeHealthStratum.Solution, |
| 15 | IdeHealthScope Scope = IdeHealthScope.Solution, |
| 16 | string? ProjectPath = null); |
| 17 | |
| 18 | /// <summary> |
| 19 | /// Страт A (workspace, ADR 0095): рабочая копия — сейчас сегмент <see cref="Git"/>; дальше без ломки контракта можно добавить поля рядом с git. |
| 20 | /// </summary> |
| 21 | public readonly record struct IdeHealthWorkspaceInput(IdeHealthSegmentInput Git); |
| 22 | |
| 23 | /// <summary> |
| 24 | /// Страт B (solution, ADR 0095): решение/проект — сборка, тесты, отладка в одной полосе IDE Health. |
| 25 | /// </summary> |
| 26 | public readonly record struct IdeHealthSolutionInput( |
| 27 | IdeHealthSegmentInput Build, |
| 28 | IdeHealthSegmentInput Tests, |
| 29 | IdeHealthSegmentInput Debug); |
| 30 | |
| 31 | /// <summary> |
| 32 | /// Страт C (IDE host, ADR 0095): процесс IDE — LSP/MCP/env. Поля снимка IDE Health; отдельные сегменты в полосе не обязаны |
| 33 | /// совпадать 1:1 (см. <see cref="Composition.WorkspaceHealth.IdeHealthSurfaceCompositor"/>). |
| 34 | /// </summary> |
| 35 | /// <param name="LspStatusHint">Краткая строка для LSP, когда появится провайдер; иначе <see langword="null"/>.</param> |
| 36 | public readonly record struct IdeHealthIdeHostInput(string? LspStatusHint = null); |
| 37 | |
| 38 | /// <summary> |
| 39 | /// Снимок входов <strong>IDE Health</strong> (ADR 0089): три страта (ADR 0095). Сегменты полосы (build → tests → debug) — в <see cref="Solution"/>, git — в <see cref="Workspace"/>. |
| 40 | /// Реализует <see cref="ICockpitComputeUnitPayload"/>: нормализованная полезная нагрузка на границе CCU (ADR 0097) — до композитора/полос; без DAP. |
| 41 | /// Слой канала (ADR 0036 п.1) → <see cref="IdeHealthFormattingUnit"/> (текст), затем |
| 42 | /// <see cref="Composition.WorkspaceHealth.IdeHealthSurfaceCompositor"/> (порядок сегментов, ADR 0036 п.3). EICAS — иной контур (<see cref="IEicasFeed"/>). |
| 43 | /// </summary> |
| 44 | public readonly record struct IdeHealthInputSnapshot( |
| 45 | IdeHealthWorkspaceInput Workspace, |
| 46 | IdeHealthSolutionInput Solution, |
| 47 | IdeHealthIdeHostInput IdeHost) : ICockpitComputeUnitPayload |
| 48 | { |
| 49 | /// <summary>Тесты и фиктивные снимки: сборка сегментов без ручного конструктора вложенных структур.</summary> |
| 50 | public static IdeHealthInputSnapshot FromFlat( |
| 51 | IdeHealthSegmentInput build, |
| 52 | IdeHealthSegmentInput tests, |
| 53 | IdeHealthSegmentInput debug, |
| 54 | IdeHealthSegmentInput git) => |
| 55 | IdeHealthStrataComposer.Compose( |
| 56 | new IdeHealthWorkspaceInput(git), |
| 57 | new IdeHealthSolutionInput(build, tests, debug), |
| 58 | default); |
| 59 | } |
| 60 | |