/*
 * Runtime Web – Unified Serverless Framework for Full-Stack TypeScript Applications
 * Documentation: https://runtimeweb.com/docs/getting-started
 *
 * @template: ai-chat
 */

/**
 * UI Types
 *
 * Type definitions for the AI Chat UI components.
 * These types define the data structures used for messages,
 * behavior modes, and chat state management.
 */

/**
 * Behavior mode for AI response generation.
 * Controls the temperature/creativity of AI responses.
 *
 * - 'precise': Low temperature (0.1) - factual, deterministic responses
 * - 'balanced': Medium temperature (0.5) - balanced creativity and accuracy
 * - 'creative': High temperature (0.9) - more creative, varied responses
 */
export type BehaviorMode = 'precise' | 'balanced' | 'creative';

/**
 * A single message in the chat conversation.
 * Represents either a user message or an assistant response.
 */
export interface Message {
    /** Unique identifier for the message */
    id: string;
    /** The role of the message sender */
    role: 'user' | 'assistant';
    /** The text content of the message */
    content: string;
    /** ISO timestamp of when the message was created */
    timestamp: string;
    /** Whether the message is currently being streamed (assistant only) */
    isStreaming?: boolean;
}

/**
 * The complete state of the chat interface.
 * Used for managing the chat UI state in React components.
 */
export interface ChatState {
    /** Array of all messages in the current conversation */
    messages: Message[];
    /** Whether a request is currently in progress */
    isLoading: boolean;
    /** Error from the last failed request, if any */
    error: Error | null;
    /** Unique identifier for the current session */
    sessionId: string;
}
