import { PaginationRequest } from "@/types/globals"; import { httpDeleteInterceptor, httpGetInterceptor, httpPostInterceptor, httpPutInterceptor, } from "./http-config/http-interceptor-services"; import { httpGet } from "./http-config/http-base-services"; export async function getAgentData(props: PaginationRequest) { const { page, limit, search } = props; return await httpGetInterceptor(`/sales-agents`); } export async function getAgentById(id: any) { const headers = { "content-type": "application/json", }; return await httpGet(`/sales-agents/${id}`, headers); } export async function createAgent(data: any) { const headers = { "content-type": "multipart/form-data", }; return await httpPostInterceptor(`/sales-agents`, data, headers); } export async function updateAgent(id: number, data: any) { const headers = { "content-type": "multipart/form-data", }; return await httpPutInterceptor(`/sales-agents/${id}`, data, headers); } export async function deleteAgent(id: string) { const headers = { "content-type": "application/json", }; return await httpDeleteInterceptor(`sales-agents/${id}`, headers); } export async function approveAgent(id: string | number) { const headers = { "content-type": "application/json", }; return await httpPutInterceptor(`/sales-agents/${id}/approve`, {}, headers); } export async function rejectAgent(id: string | number, message?: string) { const headers = { "content-type": "application/json", }; return await httpPutInterceptor( `/sales-agents/${id}/reject`, { message }, headers, ); } export async function commentAgent(id: string | number, message?: string) { const headers = { "content-type": "application/json", }; return await httpPutInterceptor( `/sales-agent/${id}/comment`, { message }, headers, ); } export async function getApprovalHistory( moduleType: string, moduleId: string | number, ) { const headers = { "content-type": "application/json", }; return await httpGet( `/approval-histories/${moduleType}/${moduleId}`, headers, ); }