import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { twMerge } from "tailwind-merge";
function getStatusText(status) {
    switch (status) {
        case "success":
            return "Upload successful";
        case "failed":
            return "Upload failed";
        case "unsupported-document-type":
            return "Document not supported by this drive";
        case "pending":
            return "Pending resolution";
        case "conflict":
            return "Pending Resolution";
        case "uploading":
            return "Uploading...";
        default:
            return "";
    }
}
function getStatusColor(status) {
    switch (status) {
        case "success":
            return "text-green-700";
        case "failed":
        case "unsupported-document-type":
        case "pending":
        case "conflict":
            return "text-red-900";
        case "uploading":
            return "text-gray-900";
        default:
            return "text-gray-900";
    }
}
function shouldShowCTA(status, onOpenDocument, onFindResolution) {
    return ((status === "success" && Boolean(onOpenDocument)) ||
        (status === "pending" && Boolean(onFindResolution)) ||
        (status === "conflict" && Boolean(onFindResolution)));
}
function getCTAText(status) {
    if (status === "success")
        return "Open Document";
    if (status === "pending")
        return "Find resolution";
    if (status === "conflict")
        return "Find resolution";
    return "";
}
export function UploadFileItemStatusRow(props) {
    const { status, progress = 0, onOpenDocument, onFindResolution } = props;
    const handleCTAClick = () => {
        if (status === "success" && onOpenDocument)
            onOpenDocument();
        else if ((status === "pending" || status === "conflict") &&
            onFindResolution)
            onFindResolution();
    };
    return (_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("div", { className: twMerge("text-xs leading-[18px]", getStatusColor(status)), children: getStatusText(status) }), status === "uploading" && (_jsxs("div", { className: "text-xs font-medium leading-[18px] text-gray-900", children: [Math.round(progress), "%"] })), shouldShowCTA(status, onOpenDocument, onFindResolution) && (_jsx("button", { type: "button", onClick: handleCTAClick, className: "text-xs leading-[18px] text-blue-900 hover:opacity-80", children: getCTAText(status) }))] }));
}
//# sourceMappingURL=status-row.js.map