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

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

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

  addOutput(id, msg.data as CommandOutput)

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

export function handleStreamAppend(msg: Message) {
  appendOutput(msg.id!, msg.data as CommandOutput)
}

export function handleStreamReplace(msg: Message) {
  replaceOutput(msg.id!, msg.data as CommandOutput)
}

export function handleStreamEnd(_msg: Message) {
}
