import { MessageList } from './MessageList'
import { MessageInput } from './MessageInput'
import type { ChatMessage, Attachment } from '../../types/protocol'

interface ChatContainerProps {
  messages: ChatMessage[]
  isLoading: boolean
  isReadOnly?: boolean
  channelName?: string
  onSendMessage: (content: string, attachments: Attachment[]) => void
  onNavigateToSubAgent?: (taskId: string, description: string) => void
  onStop?: () => void
  showThinking?: boolean
}

export function ChatContainer({
  messages,
  isLoading,
  isReadOnly = false,
  channelName,
  onSendMessage,
  onNavigateToSubAgent,
  onStop,
  showThinking = true,
}: ChatContainerProps) {
  return (
    <div className="flex h-full flex-col">
      <div className="flex-1 overflow-hidden">
        <MessageList messages={messages} onNavigateToSubAgent={onNavigateToSubAgent} showThinking={showThinking} />
      </div>
      <MessageInput
        onSend={onSendMessage}
        onStop={onStop}
        disabled={isLoading}
        isLoading={isLoading}
        isReadOnly={isReadOnly}
        channelName={channelName}
      />
    </div>
  )
}
