import { request } from '../../../utils';
import { API } from '../../../types';
import { ResponseType } from '../response-type';

export interface PostGetLastUpdate extends ResponseType {
  date: string;
}

export interface PostGetPremiumStatus extends ResponseType {
  'premium-status': number;
}

export const appApi = {
  deleteUser: (token: string) => request.postForm(API.DELETE_USER, { token }),
  getLastRegionsUpdate: (date: string) =>
    request.postForm<PostGetLastUpdate>(API.GET_LAST_REGIONS_DB_UPDATE, { date }),
  getLastDareUpdate: (date: string) =>
    request.postForm<PostGetLastUpdate>(API.GET_LAST_DARE_DB_UPDATE, { date }),
  premiumStatus: (token: string) =>
    request.postForm<PostGetPremiumStatus>(API.GET_PREMIUM_STATUS, { token }),
  getLastMapTilesUpdate: () => request.postForm<PostGetLastUpdate>(API.GET_LAST_MAP_TILES_UPDATE)
};
