import axios from 'axios';
import { CORE_PROXY_URL } from 'core/constants/urls';
import {
  GetCalculationResponse,
  PreparedData,
} from './types/Calculation/request';
import { RequestFinGAP, ResponseFinGAP } from './types/Cerebellum/finGAP';

export default class {
  static calculate = (preparedData: PreparedData) =>
    axios
      .post<GetCalculationResponse>(
        String.prototype.concat(
          CORE_PROXY_URL,
          '/api',
          '/calculation',
          '/calculate',
        ),
        preparedData,
      )
      .then(res => res.data);

  static finGAP = (requestFinGAP: RequestFinGAP) =>
    axios
      .post<ResponseFinGAP>(
        String.prototype.concat(
          CORE_PROXY_URL,
          '/api',
          '/cerebellum',
          '/finGAP',
        ),
        requestFinGAP,
      )
      .then(res => res.data);
}
