import httpClient from '@/api/httpClient';
import { API_URLS } from '@/api/URLs';
import { AxiosResponse } from 'axios';
import { CreateAdsResponse, PriceCalculationRes } from './types';

export const price_calculation = {
  async calculation(params: {
    country: string;
    region: string;
    district: string | 'all';
    letters: string | any;
    types: string;
  }): Promise<AxiosResponse<PriceCalculationRes>> {
    const res = await httpClient.get(API_URLS.Price_Calculation, { params });
    return res;
  },

  async ad(body: FormData): Promise<AxiosResponse<CreateAdsResponse>> {
    const res = await httpClient.post(API_URLS.Add_Ads, body, {
      headers: {
        'Content-Type': 'multipart/form-data',
      },
    });
    return res;
  },
  async payment(body: { return_url: string; adId: number; paymentType: 'payme' | 'referral' }) {
    const res = await httpClient.post(API_URLS.Payment_Ads(body.paymentType, body.adId), {
      return_url: body.return_url,
    });
    return res;
  },
};
