import { jsx as _jsx } from "react/jsx-runtime";
import { useCallback } from "react";
import { UserPicker, } from "../../components/ui/UserPicker";
import { searchTaskAssignableUsers } from "../services/taskService";
export function ProjectExecutionUserPicker({ projectId, value, displayValue, disabled = false, placeholder = "Choose user", buttonTestId, onChange, }) {
    const searchUsers = useCallback(async (query, limit) => {
        const result = await searchTaskAssignableUsers(projectId, query, limit);
        return result.type === "success" ? (result.data ?? []) : [];
    }, [projectId]);
    return (_jsx(UserPicker, { value: value, displayValue: displayValue, disabled: disabled, placeholder: placeholder, buttonTestId: buttonTestId, searchUsers: searchUsers, onChange: (next) => {
            if (!next)
                return;
            onChange({
                userId: next.userName,
                displayName: next.displayName,
            });
        } }));
}
//# sourceMappingURL=ProjectExecutionUserPicker.js.map