/**
 * Playground Types
 * 
 * Types for the API playground (Try It Out functionality)
 */

import type { BrainfishRESTRequest } from '../types'

export interface PlaygroundRequest {
  request: BrainfishRESTRequest
  // Editable values (user can modify before sending)
  params: Array<{ key: string; value: string; active: boolean }>
  headers: Array<{ key: string; value: string; active: boolean }>
  body: string | null
  variables: Array<{ key: string; value: string; active: boolean }>
}

export interface PlaygroundResponse {
  status: number
  statusText: string
  headers: Record<string, string>
  body: string | Blob | null
  responseTime: number
  size: number
  error?: string
  /** Whether this was a streaming response (SSE) */
  isStreaming?: boolean
}

export type PlaygroundResponseState = 
  | { type: 'idle' }
  | { type: 'loading' }
  | { type: 'streaming'; response: PlaygroundResponse }
  | { type: 'success'; response: PlaygroundResponse }
  | { type: 'error'; error: string; response?: PlaygroundResponse }
