/* eslint-disable import/prefer-default-export */
import type { QueryFunctionContext } from '@tanstack/react-query';
import axios from 'axios';
import type { RequestFinGAP, ResponseFinGAP } from './types';

export async function calculateFinGAP(payload: RequestFinGAP, { signal }: QueryFunctionContext) {
  const { data } = await axios.post<ResponseFinGAP>(
    process.env.NEXT_PUBLIC_URL_CORE_FINGAP_PROXY!,
    payload,
    {
      signal,
    }
  );

  return data;
}
