import { PayInfo, Profile, ProfileRequest, ProfileData } from '../types/profile';
import { ExpertsTags } from '../types/tags';
import { EducationData, EducationDTO } from '../types/education';
import { PracticeData, PracticeDTO } from '../types/practice';
import { ScheduleDTO } from '../types/schedule';
import { apiRequest } from './helpers';

export const getUserData = (locale: string, token: string): Promise<Profile> => apiRequest({
    url: '/home/userdata',
    method: 'post',
    locale,
    token
});

export const getPersonalData = (locale: string, token: string): Promise<ProfileData> => apiRequest({
    url: '/home/person1',
    method: 'post',
    locale,
    token
});

export const setPersonData = (data: ProfileRequest, locale: string, token: string): Promise<{ userData: Profile }> => apiRequest({
    url: '/home/applyperson1',
    method: 'post',
    data,
    locale,
    token
});

export const getEducation = (locale: string, token: string): Promise<EducationDTO> => apiRequest({
    url: '/home/person2',
    method: 'post',
    locale,
    token
});

export const setEducation = (locale: string, token: string, data: EducationData): Promise<EducationData> => apiRequest({
    url: '/home/applyperson2',
    method: 'post',
    data,
    locale,
    token
});

export const getTags = (locale: string, token: string): Promise<ExpertsTags> => apiRequest({
    url: '/home/person3',
    method: 'post',
    locale,
    token
});

export const setTags = (locale: string, token: string, data: ExpertsTags): Promise<ExpertsTags> => apiRequest({
    url: '/home/applyperson3',
    method: 'post',
    data,
    locale,
    token
});

export const getPractice = (locale: string, token: string): Promise<PracticeDTO> => apiRequest({
    url: '/home/person4',
    method: 'post',
    locale,
    token
});

export const setPractice = (locale: string, token: string, data: PracticeData): Promise<PracticeDTO> => apiRequest({
    url: '/home/applyperson4',
    method: 'post',
    data,
    locale,
    token
});

export const getSchedule = (locale: string, token: string): Promise<ScheduleDTO> => apiRequest({
    url: '/home/person51',
    method: 'post',
    locale,
    token
});

export const setSchedule = (locale: string, token: string, data: ScheduleDTO): Promise<ScheduleDTO> => apiRequest({
    url: '/home/applyperson51',
    method: 'post',
    data,
    locale,
    token
});

export const getPayData = (locale: string, token: string): Promise<{ person6Data?: PayInfo }> => apiRequest({
    url: '/home/person6',
    method: 'post',
    locale,
    token
});

export const setPayData = (locale: string, token: string, data: PayInfo): Promise<PayInfo> => apiRequest({
    url: '/home/applyperson6',
    method: 'post',
    data,
    locale,
    token
});
