/**
 * RfiSendBackForm — Feedback textarea + option tag selector for agent send-back mode.
 */
'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState, useCallback } from 'react';
import { cn } from '../../utils/cn.js';
import { RfiOptionTagSelector } from './rfi_option_tag_selector.js';
export function RfiSendBackForm({ available_response_options, initial_selected_options, initial_feedback = '', on_send_back, disabled, className, }) {
    const [feedback, set_feedback] = useState(initial_feedback);
    const [selected_options, set_selected_options] = useState(initial_selected_options ?? []);
    const can_send = feedback.trim().length > 0 && selected_options.length > 0;
    const handle_send = useCallback(() => {
        if (!can_send || !on_send_back)
            return;
        on_send_back({ feedback: feedback.trim(), response_options: selected_options });
    }, [can_send, on_send_back, feedback, selected_options]);
    return (_jsxs("div", { className: cn('space-y-4 pt-3', className), children: [_jsxs("div", { className: "space-y-1", children: [_jsxs("label", { className: "text-xs font-bold uppercase tracking-wide text-amber-700", children: ["Your Feedback to Client ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("textarea", { value: feedback, onChange: e => set_feedback(e.target.value), disabled: disabled, rows: 3, className: cn('w-full px-3 py-2 rounded-md border bg-white text-sm', 'focus:outline-none focus:ring-2 focus:ring-amber-300 focus:border-amber-400', 'resize-y min-h-[60px]', !feedback.trim() ? 'border-amber-300' : 'border-border'), placeholder: "Explain what's wrong and what the client should do..." })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("label", { className: "text-xs font-bold uppercase tracking-wide text-muted-foreground", children: ["Client Response Options ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx(RfiOptionTagSelector, { available_options: available_response_options, selected_options: selected_options, on_change: set_selected_options, disabled: disabled })] }), _jsx("div", { className: "flex justify-end", children: _jsx("button", { type: "button", onClick: handle_send, disabled: disabled || !can_send, className: cn('px-5 py-2.5 rounded-md text-sm font-medium transition-colors shadow-sm', can_send && !disabled
                        ? 'bg-red-600 text-white hover:bg-red-700'
                        : 'bg-muted text-muted-foreground cursor-not-allowed'), children: "Send to Client" }) })] }));
}
//# sourceMappingURL=rfi_send_back_form.js.map