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

export interface PostGetSettings {
  settings: {
    name: 'app-ios' | 'app-android' | 'app-friends' | 'email-friends' | 'app-messages';
    active: 0 | 1;
  }[];
}

export interface Settings {
  token: string;
  settings: string;
}

export const notificationsApi = {
  getSettings: (token: string) =>
    request.postForm<PostGetSettings>(API.GET_NOTIFICATIONS_SETTINGS, { token }),
  setSettings: (data: Settings) =>
    request.postForm<ResponseType>(API.SET_NOTIFICATIONS_SETTINGS, data)
};
