import type { PayoutListData } from "@/pages/payout-request/lib/types";
import httpClient from "@/shared/config/api/httpClient";
import { PAYOT_REQUEST } from "@/shared/config/api/URLs";
import type { AxiosResponse } from "axios";

const sendpayout = async ({ body }: { body: { amount: number } }) => {
  const res = await httpClient.post(PAYOT_REQUEST, body);
  return res;
};

const upatePayout = async ({
  body,
  id,
}: {
  id: number;
  body: { status: string };
}) => {
  const res = await httpClient.patch(`${PAYOT_REQUEST}${id}/`, body);
  return res;
};

const getPayoutList = async (params: {
  page_size: number;
  page: number;
  status: "pending" | "approved" | "cancelled" | "";
}): Promise<AxiosResponse<PayoutListData>> => {
  const res = await httpClient.get(PAYOT_REQUEST, { params });
  return res;
};

export { getPayoutList, sendpayout, upatePayout };
