import { http } from "@/shared/api/httpClient";
import { API_ROUTES } from "@/shared/constants/api-routes";

import {
  CheckoutRequest,
  CheckoutResponse,
  CheckoutResponseSchema,
  SingleCheckoutRequest,
  SingleCheckoutResponse,
  SingleCheckoutResponseSchema,
} from "./types";

export async function createPaymentCheckout(payload: CheckoutRequest) {
  return http.post<CheckoutResponse>(API_ROUTES.paymentCheckout(), payload, {
    schema: CheckoutResponseSchema,
    revalidate: 0,
  });
}

export async function createSinglePaymentCheckout(
  payload: SingleCheckoutRequest
) {
  return http.post<SingleCheckoutResponse>(
    API_ROUTES.paymentSingleCheckout(),
    payload,
    {
      schema: SingleCheckoutResponseSchema,
      revalidate: 0,
    }
  );
}
