'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { IssueGroupTree } from './issue_group_tree.js';
import { cn } from './shared.js';
/**
 * One rule's row inside the batch decisions panel.
 *
 * Renders the rule name + issue count, a 3-state radio group, and (when
 * Send Back is selected) an editable comment textarea. Issue details from
 * the underlying IssueGroupTree are shown in display-only mode (no per-rule
 * Send Back button) so the agent can still drill down into individual
 * issues if needed.
 */
export function RuleDecisionRow({ content_id, rule_result, value, comment, default_comment, on_value_change, on_comment_change, }) {
    const issue_count = rule_result.issues.length;
    const send_back_selected = value === 'sent_back';
    const radio_name = `rule-decision-${rule_result.rule_id}`;
    return (_jsxs("div", { className: "border border-[#E2E8F0] rounded-md bg-white", children: [_jsxs("div", { className: "flex items-center gap-3 px-3 py-2", children: [_jsx("span", { className: "text-[12px] font-medium text-[#1E293B] flex-1", children: rule_result.rule_name || rule_result.rule_id }), _jsxs("span", { className: "text-[11px] text-[#64748B]", children: [issue_count, " issue", issue_count !== 1 ? 's' : ''] })] }), _jsx("div", { className: "px-3 py-2 border-t border-[#F1F5F9] flex items-center gap-4 text-[11px] text-[#334155]", children: ['pending', 'accepted', 'sent_back'].map(opt => (_jsxs("label", { className: "flex items-center gap-1.5 cursor-pointer", children: [_jsx("input", { type: "radio", name: radio_name, value: opt, checked: value === opt, onChange: () => on_value_change(opt), className: "cursor-pointer" }), _jsx("span", { className: cn(opt === 'accepted' && value === 'accepted' && 'text-[#059669] font-medium', opt === 'sent_back' && value === 'sent_back' && 'text-[#D97706] font-medium'), children: opt === 'pending' ? 'Pending' : opt === 'accepted' ? 'Accept' : 'Send Back' })] }, opt))) }), _jsx("div", { className: "border-t border-[#F1F5F9]", children: _jsx(IssueGroupTree, { mode: "agent", content_id: content_id, result: rule_result, hide_actions: true }) }), send_back_selected && (_jsxs("div", { className: "border-t border-[#F1F5F9] bg-[#FFFBEB] px-3 py-2 space-y-1", children: [_jsx("div", { className: "text-[10px] font-semibold text-[#92400E] uppercase tracking-wider", children: "Message to client" }), _jsx("textarea", { value: comment, onChange: (e) => on_comment_change(e.target.value), placeholder: default_comment, rows: 3, className: "w-full text-[12px] text-[#1E293B] border border-[#FCD34D] rounded px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-[#F59E0B] bg-white" })] }))] }));
}
//# sourceMappingURL=rule_decision_row.js.map