import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Box } from "ink";
import { StatusBadge } from "./design/StatusBadge.js";
import { MessageModel } from "./MessageModel.js";
import { MessageTimestamp } from "./MessageTimestamp.js";
export function MessageRow(props) {
    const model = messageRowModel({
        isToolLike: Boolean(props.isToolLike),
        hasMetadata: Boolean(props.metadata),
    });
    return (_jsxs(Box, { flexDirection: "column", marginBottom: model.marginBottom, children: [model.showMetadata && props.metadata ? (_jsxs(Box, { flexDirection: "row", justifyContent: "flex-end", gap: 1, width: props.width, children: [_jsx(MessageTimestamp, { timestamp: props.metadata.timestamp }), _jsx(MessageModel, { model: props.metadata.model, streaming: props.metadata.streaming })] })) : null, _jsx(Box, { flexDirection: "row", children: _jsx(StatusBadge, { label: props.meta.label, tone: props.meta.tone }) }), _jsx(Box, { paddingLeft: model.bodyPaddingLeft, children: props.children })] }));
}
export function messageRowModel(input) {
    return {
        marginBottom: input.isToolLike ? 0 : 1,
        bodyPaddingLeft: 2,
        showMetadata: input.hasMetadata,
    };
}
