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

export interface PostGetDates extends ResponseType {
  dates: string[];
}

export interface TriumphsData {
  user_id: number;
  name: string;
  type: string;
  treshold: number;
  avatar: string | null;
  flag: string;
  text: string;
  icon: string;
}

export interface PostGetData extends ResponseType {
  triumphs: TriumphsData[];
}

export const triumphsApi = {
  getDates: () => request.postForm<PostGetDates>(API.GET_TRIUMPHS_DATES),
  getData: (date: string) => request.postForm<PostGetData>(API.GET_TRIUMPHS_DATA, { date })
};
