import httpClient from '@/api/httpClient'; import { API_URLS } from '@/api/URLs'; import { ProductBody, ProductResponse } from '@/screens/home/lib/types'; import { AxiosResponse } from 'axios'; import { ExployeesResponse, MyAdsData, MyAdsDataRes, MyBonusesData, NotificationListRes, UserInfoResponseData, } from './type'; export const user_api = { async getMe(): Promise> { const res = await httpClient.get(API_URLS.Get_Me); return res; }, async updateMe(body: { first_name: string; industries: { id: number; name: string; code: string; external_id: null | number; level: number; is_leaf: boolean; icon_name: null | string; parent: { id: number; name: string; code: string; }; }[]; person_type: 'employee' | 'legal_entity' | 'ytt' | 'band'; phone: string; activate_types: number[]; age: number | null; gender: 'male' | 'female' | null; }) { const res = await httpClient.patch(API_URLS.User_Update, body); return res; }, async employess(params: { page: number; page_size: number; }): Promise> { const res = await httpClient.get(API_URLS.Employee_List, { params }); return res; }, async create_employee(body: { first_name: string; last_name: string; phone: string }) { const res = await httpClient.post(API_URLS.Employee_List, body); return res; }, async my_ads(params: { page: number; page_size: number }): Promise> { const res = await httpClient.get(API_URLS.My_Ads, { params }); return res; }, async my_bonuses(params: { page: number; page_size: number; }): Promise> { const res = await httpClient.get(API_URLS.My_Bonuses, { params }); return res; }, async my_sevices(params: { page: number; page_size: number; my: boolean; }): Promise> { const res = await httpClient.get(API_URLS.Get_Products, { params }); return res; }, async add_service(body: FormData) { const res = await httpClient.post(API_URLS.Get_Products, body, { headers: { 'Content-Type': 'multipart/form-data' }, }); return res; }, async update_service({ body, id }: { body: FormData; id: number }) { const res = await httpClient.patch(API_URLS.Detail_Products(id), body, { headers: { 'Content-Type': 'multipart/form-data' }, }); return res; }, async delete_service(id: number) { const res = await httpClient.delete(API_URLS.Delete_Products(id)); return res; }, async detail_service( id: number ): Promise> { const res = await httpClient.get(API_URLS.Detail_Products(id)); return res; }, async ads_detail(id: number): Promise> { const res = await httpClient.get(API_URLS.Ads_Detail(id)); return res; }, async my_referrals(params: { page: number; page_size: number }) { const res = await httpClient.get(API_URLS.My_Refferals, { params }); return res; }, async create_referral(body: { code: string; referral_share: number; description: string; is_agent: boolean; }) { const res = await httpClient.post(API_URLS.My_Refferals, body); return res; }, async notification_list(params: { page: number; page_size: number; }): Promise> { const res = await httpClient.get(API_URLS.Notification_List, { params }); return res; }, async is_ready_id(id: number) { const res = await httpClient.post(API_URLS.Notification_Ready(id)); return res; }, async mark_all_as_read() { const res = await httpClient.post(API_URLS.Notification_Mark_All_Read); return res; }, };