import type { StreamMessage } from "@/shared/types"
import { addOutput, appendOutput, replaceOutput } from "./scrollback"

export function handleStreamStart(msg: StreamMessage) {
  const id = msg.id

  const status = document.querySelector(`[data-id="${id}"].input .status`)
  if (!status) return

  addOutput(id, msg.data)

  status.classList.remove("yellow")
  status.classList.add("purple")
}

export function handleStreamAppend(msg: StreamMessage) {
  appendOutput(msg.id, msg.data)
}

export function handleStreamReplace(msg: StreamMessage) {
  replaceOutput(msg.id, msg.data)
}

export function handleStreamEnd(_msg: StreamMessage) {
}
