/**
 * TUI Types
 */

import type { APIClient, Session, Message, HealthStatus } from '../client/api.js';

export interface TUIConfig {
  client: APIClient;
  sessionId?: string;
}

export interface TUIState {
  sessions: Session[];
  currentSession: Session | null;
  messages: Message[];
  health: HealthStatus | null;
  isConnected: boolean;
  isLoading: boolean;
  error: string | null;
}

export interface ChatMessage {
  id: string;
  role: 'user' | 'assistant' | 'system';
  content: string;
  timestamp: string;
  isStreaming?: boolean;
}

export type TUIEventType =
  | 'session:select'
  | 'session:create'
  | 'session:delete'
  | 'message:send'
  | 'message:chunk'
  | 'message:done'
  | 'connection:open'
  | 'connection:close'
  | 'connection:error'
  | 'quit';

export interface TUIEvent<T = unknown> {
  type: TUIEventType;
  payload?: T;
}
