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

const { URL_CORE_FINGAP } = getUrls();

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

  return data;
}
