<?php

declare(strict_types=1);

namespace Drupal\flowdrop_ui_components\Constants;

/**
 * Snapshot of DEFAULT_SETTINGS from the bundled FlowDrop library.
 *
 * Mirrors `lib/flowdrop/src/lib/types/settings.ts:DEFAULT_SETTINGS`. Used by
 * the UI Settings form's "Load library defaults" helper button so site builders
 * can see the full settings shape without leaving the admin UI.
 *
 * Re-sync this when the bundled library bumps and the canonical defaults
 * change.
 *
 * @internal Not part of the public API.
 */
final class LibraryDefaultSettings {

  /**
   * Library version this snapshot reflects.
   *
   * Bumped together with the bundled @flowdrop/flowdrop version in
   * lib/flowdrop/package.json.
   */
  public const SOURCE_LIBRARY_VERSION = '1.10.0';

  /**
   * Return the full default-settings snapshot.
   *
   * @return array<string, array<string, mixed>>
   *   The full settings snapshot, keyed by setting group.
   */
  public static function all(): array {
    return [
      'theme' => [
        'preference' => 'dark',
      ],
      'editor' => [
        'showGrid' => TRUE,
        'snapToGrid' => TRUE,
        'gridSize' => 20,
        'showMinimap' => TRUE,
        'defaultZoom' => 1,
        'fitViewOnLoad' => TRUE,
        'proximityConnect' => FALSE,
        'proximityConnectDistance' => 150,
      ],
      'ui' => [
        'sidebarWidth' => 280,
        'sidebarCollapsed' => FALSE,
        'compactMode' => FALSE,
        'theme' => 'default',
        'consoleOpen' => FALSE,
        'consoleHeight' => 300,
        'bottomPanelTab' => 'console',
      ],
      'behavior' => [
        'autoSave' => FALSE,
        'autoSaveInterval' => 30000,
        'undoHistoryLimit' => 50,
        'confirmDelete' => FALSE,
        'chatAutoRetry' => TRUE,
      ],
      'api' => [
        'timeout' => 30000,
        'retryEnabled' => TRUE,
        'retryAttempts' => 3,
        'cacheEnabled' => FALSE,
      ],
    ];
  }

}
