| 1 | namespace CascadeIDE.Models; |
| 2 | |
| 3 | /// <summary>Настройки Intercom. TOML: <c>[intercom.*]</c> (ADR 0130).</summary> |
| 4 | public sealed class IntercomSettings |
| 5 | { |
| 6 | /// <summary> |
| 7 | /// Плотность ленты и composer: <c>comfortable</c> (prose_pt, MFD-отступы) или <c>compact</c> (prose_pt_forward + SkiaChatDensity). |
| 8 | /// TOML: <c>[intercom] feed_metrics</c>. |
| 9 | /// </summary> |
| 10 | public string FeedMetrics { get; set; } = IntercomFeedMetricsModes.Comfortable; |
| 11 | |
| 12 | /// <summary> |
| 13 | /// Глиф валидации slash в CCL/composer: <c>left</c>, <c>right</c> (по умолчанию), <c>highlight_only</c>. |
| 14 | /// TOML: <c>[intercom] tci_validation_icon</c>. |
| 15 | /// </summary> |
| 16 | public string TciValidationIcon { get; set; } = TciValidationIconModes.Right; |
| 17 | |
| 18 | /// <summary>Вложения в ленте. TOML: <c>[intercom.attachments.*]</c>.</summary> |
| 19 | public IntercomAttachmentsSettings Attachments { get; set; } = new(); |
| 20 | |
| 21 | /// <summary>Team transport (FederatedSync). TOML: <c>[intercom.transport]</c> (ADR 0144).</summary> |
| 22 | public IntercomTransportSettings Transport { get; set; } = new(); |
| 23 | |
| 24 | public bool UseComfortableFeedMetrics() => IntercomFeedMetricsModes.IsComfortable(FeedMetrics); |
| 25 | } |
| 26 | |
| 27 | /// <summary>TOML: секция-родитель <c>[intercom.attachments]</c> (поля — во вложенных таблицах).</summary> |
| 28 | public sealed class IntercomAttachmentsSettings |
| 29 | { |
| 30 | /// <summary>Code-якоря (F:/M:/L:, chip, reveal/select). TOML: <c>[intercom.attachments.code]</c>.</summary> |
| 31 | public IntercomAttachmentsCodeSettings Code { get; set; } = new(); |
| 32 | } |
| 33 | |
| 34 | /// <summary>Навигация и загрузка решения для code-attach. TOML: <c>[intercom.attachments.code]</c>.</summary> |
| 35 | public sealed class IntercomAttachmentsCodeSettings |
| 36 | { |
| 37 | /// <summary> |
| 38 | /// Клик по attach-chip: <c>reveal</c> (transient highlight) или <c>select</c> (selection в редакторе). |
| 39 | /// Shift+клик всегда select. MCP с явным <c>select</c> переопределяет дефолт. |
| 40 | /// </summary> |
| 41 | public string Navigate { get; set; } = "reveal"; |
| 42 | |
| 43 | /// <summary> |
| 44 | /// Перед reveal: <c>when_needed</c> — .sln от файла, если не совпадает с открытым; |
| 45 | /// <c>never</c> — только open/reveal файла. |
| 46 | /// </summary> |
| 47 | public string RevealLoadSolution { get; set; } = IntercomAttachmentsCodeRevealLoadSolutionModes.WhenNeeded; |
| 48 | |
| 49 | public bool DefaultNavigateSelects() => |
| 50 | string.Equals(Navigate, "select", StringComparison.OrdinalIgnoreCase); |
| 51 | |
| 52 | public bool ShouldLoadSolutionBeforeReveal() => |
| 53 | !string.Equals( |
| 54 | RevealLoadSolution?.Trim(), |
| 55 | IntercomAttachmentsCodeRevealLoadSolutionModes.Never, |
| 56 | StringComparison.OrdinalIgnoreCase); |
| 57 | } |
| 58 | |
| 59 | /// <summary>Значения <see cref="IntercomAttachmentsCodeSettings.RevealLoadSolution"/>.</summary> |
| 60 | public static class IntercomAttachmentsCodeRevealLoadSolutionModes |
| 61 | { |
| 62 | public const string WhenNeeded = "when_needed"; |
| 63 | public const string Never = "never"; |
| 64 | } |
| 65 | |