import { useGetFeedback } from "@/hooks/queries";
import { usePathname, useRouter } from "next/navigation";

interface IProps {
  id: string;
  paramKey: "tender_id" | "company_id" | "customer_id";
}
const useFeedbackTablePresenter = ({ id, paramKey }: IProps) => {
  const { data, isLoading } = useGetFeedback({ [paramKey]: id });
  const router = useRouter();
  const pathName = usePathname();
  const columns = [
    "row",
    "feedback type",
    "updated at",
    "created at",
    "actions",
  ];
  const getShowcaseSectionTitle = () => {
    if (paramKey === "tender_id") {
      return `: ${data?.data?.[0]?.tender?.title}`;
    } else {
      return "";
    }
  };
  return {
    isLoading,
    feedback: data?.data,
    columns,
    pathName,
    router,
    getShowcaseSectionTitle,
  };
};

export default useFeedbackTablePresenter;
