import axiosInstance from "@/shared/services/axiosInstance"; import { withHeaders } from "@/record-management/services/api/withHeaders"; import { AxiosResponse } from "axios"; import { SiteDto, SitePayloadDto, SiteQueryParams } from "@/super-admin/dto/SitesDto"; // Fetch all sites (supports pagination/filter params) export const getSites = async ( params?: SiteQueryParams ): Promise> => { return axiosInstance.get("/sites", { headers: withHeaders(), params, }); }; // Fetch site by ID export const getSiteById = async ( id: string ): Promise> => { return axiosInstance.get(`/sites/${id}`, { headers: withHeaders(), }); }; // Create a new site export const createSite = async ( data: SitePayloadDto ): Promise> => { return axiosInstance.post("/sites", data, { headers: withHeaders(), }); }; // Update an existing site export const updateSite = async ( id: string, data: SitePayloadDto ): Promise> => { return axiosInstance.put(`/sites/${id}`, data, { headers: withHeaders(), }); }; // Soft delete (archive) a site export const softDeleteSite = async ( id: string ): Promise> => { return axiosInstance.delete(`/sites/${id}/soft`, { headers: withHeaders(), }); }; // Permanently delete a site export const deleteSite = async ( id: string ): Promise> => { return axiosInstance.delete(`/sites/${id}`, { headers: withHeaders(), }); }; // Restore an archived site export const restoreSite = async ( id: string ): Promise> => { return axiosInstance.patch(`/sites/${id}/restore`, null, { headers: withHeaders(), }); };