/**
 * Chat defaults and constants.
 */

export const STORAGE_KEYS = {
  mode: 'djc-chat-mode',
  sidebarWidth: 'djc-chat-sidebar-width',
  composerHistory: 'djc-chat-composer-history',
} as const;

export const CSS_VARS = {
  reserve: '--djc-chat-reserve',
} as const;

export const DEFAULT_Z_INDEX = 9000;

export const LIMITS = {
  /** Max characters per single message. */
  messageMaxLength: 8000,
  /** Max attachments per message. */
  attachmentsMax: 10,
  /** Composer history slots. */
  composerHistorySize: 50,
  /** Coalesce stream tokens within this window before dispatching. */
  streamCoalesceMs: 16,
  /** Default history page size. */
  pageSize: 50,
  /** Virtualize list when >= this many messages (host-controlled threshold). */
  virtualizeThreshold: 50,
  /** SSE idle timeout. */
  sseIdleMs: 45_000,
} as const;

export const DEFAULT_SIDEBAR = {
  width: 420,
  min: 320,
  max: 720,
} as const;

export const HOTKEYS = {
  send: 'mod+enter',
  cancel: 'esc',
  newChat: 'mod+shift+n',
  toggleOpen: 'mod+/',
  focusComposer: 'mod+l',
} as const;

export const CHAT_EVENT_NAME = 'djc:chat:send';

export interface ChatEventDetail {
  content: string;
  sessionId?: string;
  attachments?: unknown[];
  metadata?: Record<string, unknown>;
}
